Expand my Community achievements bar.

Making a field mandatory only when visible?

Avatar

Former Community Member

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

3 Replies

Avatar

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

Avatar

Level 3

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

Avatar

Former Community Member

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