Expand my Community achievements bar.

Error message when hiding an empty required field

Avatar

Level 3

I have a yes/no radio button in a seperate subform

In that subform i have an other subform that is hidden on "no" and is visible on yes

A field in the second subform is required when visible and not required when hidden

When hidden, the value is also reset to ""

I've put an calculation script on the first subform to do all this (also tried to put it on layout:ready)

if (button.rawValue == 1){

     subform.presence = "visible";

     subform.field.validate.nullTest = "error";

}

else{

     subform.presence = "hidden";

     subform.field.validate.nulltest = "disabled";

     subform.field.rawValue = "";

}

But when i switch between yes and no, and the second subform hides again.

Then i get an error message that the field cannot be empty.

Is there a way to avoid this message?

2 Replies

Avatar

Level 10

Hi,

When dealing with this, I first disable the validation and then hide the field. Eg the reverse order/sequence. I suspect that changing the validation does not work on a field that is hidden.

See an example here: http://assure.ly/hxHupW.

Hope that helps,

Niall