Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.

subforms and required fields

Avatar

Former Community Member
The required fields in a subform that may be invisible at times(it will only appear if a certain radio button is selected)are not allowing me to submit the form by e-mail. I get an error stating that at least one required field was empty, etc....



any suggestions?
4 Replies

Avatar

Former Community Member
Don't set the required property on the hidden fields as the default property. Instead, make them required when they are made visible. I assume you make them visible through script, so just add the logic to make them required at the same time.

Avatar

Former Community Member
Also don't forget to include logic to turn off the "required" state when the fields are made invisible.

Avatar

Former Community Member
ok i can't get it to work...



here's my code (for one object (Name[0]) on the subform). What am i doing wrong?



if (this.rawValue==1) then

Non_Airport_Subform.presence="visible"

Airport_Pick_Up_Subform.presence="invisible"

Airport_Drop_Off_Subform.presence="invisible"

else

Non_Airport_Subform.presence="hidden"

end if



if Non_Airport_Subform.presence="visible" then

Non_Airport_Subform.Name[0].type="User Entered - Required"

else

Non_Airport_Subform.Name[0].type="User Entered - Optional"

endif