Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new

Learn more

View all

Sign in to view all badges

Making a field mandatory only when visible?

Level 3
Level 3


I want to make fileds only mandatory when they are visible

I thought this code would work but it doesnt seem to do anything?

Here is my code currently - any ideas guys?

if (form1.Page1.DropDownList1.presence == "visible") {

form1.Page1.DropDownList1.mandatory = "error";


if (form1.Page1.DropDownList1.presence == "hidden") {

form1.Page1.DropDownList1.mandatory = "disabled";


Thanks in annnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnticipation!


3 Replies
Level 10
Level 10

Hi there,

instead of using adobe's validation which you need to keep track of which field should be set mandatory,

you can use my script to validate any form and it is very similar to adobe's validation, except you decide which fields you don't want to validate instead of which fields to validate.

Also if any field is hidden from the user's view it is not validated by the script. It is a very convenient script if you make any changes to a form.

Hope this will help!

Validation / Reset Functions, easy to manipulate and to change Forms!!!!

Level 3
Level 3

You code looks fine, please share your form to see what's the issue and we can help you .

Level 3
Level 3

Thanks guys for your responses - I solved this by forcing the mandatory state each time the visibilty is changed. Not the most elegant but effective.

@Magus - your script looks the business however a little to complex for me to slot into my form - I wil use it in future forms though - thx