cancel
Showing results for 
Search instead for 
Did you mean: 

java script for mandatory fields

Former Member
0 Kudos

Hi,

I have a drop down box in my interactive form with WDABAP. Depending on my selection few fields should be mandatory. If I select different value from the dropdown, then other few fileds should be mandatory. How to do this using java script?

Regards,

J.Smitha.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Depending on your selection, you can set other fields as mandatory.

Write the below script in that particular field's 'preSubmit' event. This will check the value of the filed according to the given condition and will make other specified fields as mandatory. If you want to set other fileds as mandatory in case the first filed doesn't have nay value, then use - this.rawvalue == NULL.

if (this.rawValue == X) {you can check all the values from the drop down list using 'OR' condition}

then

otherfield1.mandatory = "error"

else

otherfield1.mandatory = "disabled"

endif

if (this.rawValue == Y) {you can check all the values from the drop down list using 'OR' condition}

then

otherfield2.mandatory = "error"

else

otherfield2.mandatory = "disabled"

endif

Former Member
0 Kudos

Thanks Vishal its worked

Answers (0)