Expand my Community achievements bar.

Override Missing Info Validation for Required Fields that are Hidden

Avatar

Level 2

Hello I have created a form that has identified required fields for a user to complete. I want the user to be able to Lock and Email the form to another user; however, I have not been able to do so because the form keeps providing an error that says the user is missing required field, even though all the fields are completed. I believe the form is registering the required fields that are hidden, and not necessary for the user at that time. Is there a script or way that the required fields that are hidden can be overridden because they are not needed; however, still have the validation if missing when not hidden. I hope this makes since, I have provided an example below that will hopefully clarify what I am in need of. Thank you for your assistance.

Example:

User requests a new contact; however, the contact does not need to have an address provided so the address fields are hidden.

            Goal - User completes the information for the contact, minus the address, locks and emails the form to another user for processing.

            What's Occurring - Currently cannot lock and email form because the validation is triggering the "missing" required fields in the address section, even though the fields are hidden

6 Replies

Avatar

Level 7

Did you make the hidden fields required or are you validating them some other way. I believe a field that is hidden should not be part of the required validation. Is the field set to hidden or invisible?

Avatar

Level 2

‌Mouslander,

The hidden fields are required necessary as required because I want the same validation available (to not locl/send if missing) when the hidden fields are necessary to be completed. The fields are set as hidden and not invisible. It is my assumption they are being included in the validation because when hidden and all visible fields are completed the form is returning an error message that there are required fields missing.

Avatar

Level 2

Mouslander,

T‌hank you for your reply. Yes, the hidden fields are required because I want the user to have the same validation available (to not sign/email) when the hidden fields are necessary to be completed. I am not sure if this is why I am getting my error; however when trying to email the form an error is received that the form has required fields that are missing even when all fields (except those that are hidden) are completed.and to answer your last question yes the fields are hidden and not invisible.

Avatar

Level 7

I was able to reproduce it. I would have figured that a hidden field would not be part of the validation but you are correct it is. I was able to get around it by using the following code on the validate event for the field. In the script below I test to see if BorrowerPhone is hidden and if it is remove the mandatory flag.

if(BorrowerPhone.presence == "hidden"){

this.mandatory = "disabled";

}

Avatar

Level 2

Mouslander,

Thank you, I will try this script. Just to get my understandings correct, I am assuming I would change BorrowerPhone to the titile of my field ex. AddressLine1.presence ???

Avatar

Level 7

yes. If the script is on the current field you can also use:

if(this.presence

instead of

if(BorrowerPhone.presence