diff --git a/OFM.Application.WebResources/Scripts/FormHandler/ofm_Intake.Form.js b/OFM.Application.WebResources/Scripts/FormHandler/ofm_Intake.Form.js index 5e9c0cb..45ba5b5 100644 --- a/OFM.Application.WebResources/Scripts/FormHandler/ofm_Intake.Form.js +++ b/OFM.Application.WebResources/Scripts/FormHandler/ofm_Intake.Form.js @@ -175,5 +175,17 @@ OFM.Intake.Form = { }); return visable; + }, + validateCohortNumber: function(executionContext){ + debugger; + var formContext = executionContext.getFormContext(); + var cohort = formContext.getAttribute("ofm_cohort").getValue(); + + //validation required must be numeric and 6 digits + if(!/^\d+$/.test(cohort) || cohort.length != 6){ + formContext.getControl("ofm_cohort").setNotification("Cohort should be 6 digits in 'MMYYYY' format.", "validation_rule"); + }else{ + formContext.getControl("ofm_cohort").clearNotification("validation_rule"); + } } -}; \ No newline at end of file +};