Expand my Community achievements bar.

July 31st AEM Gems Webinar: Elevate your AEM development to master the integration of private GitHub repositories within AEM Cloud Manager.

Unique problem with validation/ making field required


Former Community Member
I have searched the forums trying to find a way to make a field required based on the users selection of a check box, or something else. So far, everything says use nullTest = "error".

I have tried to do this and get the following results: The red highlighting, which shows up around my other required fields, will not show up unless you click in the text box and then out of it. Weird! Then, when pressing the submit button, it will not actually give you an error message if there is nothing in that text box, as it will if there is nothing in the fields that I originally make required.

Any thoughts, or fixes would be greatly appreciated.

Thanks in advance for any help.
1 Reply


Former Community Member
We do the same thing here. We haven't had any issues with the submit not validating the field correctly though. Our only issue was the red highlighting. To get around this, we would call resetdata on the field. resetData clears out the value of the field so you need to store it off and then reset it.

if (form1.BP1.ChangeActivities.Pos1.Department==1) then $.validate.nullTest = "error" else $.validate.nullTest = "disabled"



var x = $


$ = x