Making a field mandatory only when visible?

ellis355

16-06-2016

Hi

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!

Ellis

Accepted Solutions (0)

Answers (3)

Answers (3)

ellis355

20-06-2016

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

Thanks

E

Magus069

MVP

16-06-2016

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!!!!