Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

Mandatory Field

Avatar

Level 7

I have a DD list with two Items(Item A and ItemB).

Is it possible in case a user select ItemA a numeric field named PO to be Mandatory?

Thanks

1 Accepted Solution

Avatar

Correct answer by
Level 10

You need to place in the Exit event of your DD List

//If the value is Item A make the PO Mandatory

If(DDList.rawValue == "Item A"){ 

     PO.mandatory = "error";

}

//If the value is Item B make the PO Optional

If(DDList.rawValue == "Item B"){ 

     PO.mandatory = "disabled";

}

Thanks

Srini

View solution in original post

4 Replies

Avatar

Level 10

You can make a field mandatory by setting the "mandatory" property.

If(DDList.rawValue == "Item A"){  

     PO.mandatory = "error";

}

Thanks

Srini

Avatar

Level 7

Thanks Srini for your help.

Where I have to put your script(What event to apply)?

Also if user select Item B is it possible the numeric field to be No Mandatory?

Thanks

Avatar

Correct answer by
Level 10

You need to place in the Exit event of your DD List

//If the value is Item A make the PO Mandatory

If(DDList.rawValue == "Item A"){ 

     PO.mandatory = "error";

}

//If the value is Item B make the PO Optional

If(DDList.rawValue == "Item B"){ 

     PO.mandatory = "disabled";

}

Thanks

Srini

Avatar

Level 2

Hi

I read with interest your post. I am trying to use the mandatory="error" and mandatory="disabled" for exclusion group on my form however it doesn't work at all. When I hit submit the fields are not being lit up as the other required text fields. The text fields i'm using the txtfield.validate.nulltest="error" tried this for the exclustion group and it didn't work either.

Suggestions??

Meir