Highlighted

Question about making mandatory fields hidden

_Bill_Bain_

05-12-2008

If I make an empty mandatory field hidden, do I have to set the mandatory property to "disabled" to prevent it from triggering the error message since it's empty?

Replies

Highlighted

pguerett

08-12-2008

If it is hidden it is not part of the layout so no it will not be included in the validation check when a submit is fired.
Highlighted

_Bill_Bain_

17-12-2008

Hmm, I hid some fields that would otherwise be required and I get the validation script message on execValidate().
Highlighted

Thomas_McConnac

18-12-2008

Oooh, didn't see this post before.



I get the same problem with the execValidate() for hidden fields. I've got a lot of script in my form to dynamically set the mandatory status as I do a lot of hiding.



Tom
Highlighted

pguerett

18-12-2008

You are calling it a problem and I say works as designed. When you make a field mandatory you are indicating that the field must have a value (in the data file). When the submit is pressed, the mandatory fields are checked and if a value for that field is not in the data dom (in the bound node) then the message s displayed (whether the field is visible or not the binding still exists). You should make the field not mandatory by default, then make it mandatory when you make it visible.
Highlighted

_Bill_Bain_

18-12-2008

I don't know that it's a problem as long as it works consistently, which it does. It's easy enough, if soemwhat laborious, to set the fields in question to disabled when they are hidden. It would be kind of nifty if one could set all the fields in a subform or table either mandatory or disabled at the subform or table level as well as at the individual field level.



No worry, I just wanted to make sure I understood it before I started twiddling with the form.
Highlighted

Thomas_McConnac

18-12-2008

Hehe, sorry Paul. Problem probably not the right word to use for you. How about:



I get the same results with the execValidate() for hidden fields. I haven't found an easy solution to this so I've got a lot of script in my form to dynamically set the mandatory status as I do a lot of hiding.



Sound better Paul? I think it is more accurate now! 🙂



Tom