Make an Adaptive Form Field required in JavaScript | Community
Skip to main content
Level 2
Apr 17, 2023 2:56 PM UTC
Solved

Make an Adaptive Form Field required in JavaScript

I have an Adaptive Form and I'd like to make a given field required via JavaScript.  I have tried the following:

field.mandatory = "error"

field.mandatory = "true"

field.mandatory = true

field.required = "error"

field.required = true

I have also tried all of the above together with field.validationsDisabled = false and validationsDisabled = "false".

Thanks

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Vijay_Katoch
Vijay_KatochAccepted solution
New Participant
Apr 18, 2023 4:13 AM UTC

I added a field and submit button in an adaptive form.

On field initialize event in Code editor, below works for me when I submitted the form without entering any data.

this.mandatory="true";

3 replies

Vijay_Katoch
New Participant
Apr 20, 2023 1:56 PM UTC

 

Took radio group also, and it's working, see attached

 

 

 

Translate
Vijay_Katoch
Vijay_KatochAccepted solution
New Participant
Apr 18, 2023 4:13 AM UTC

I added a field and submit button in an adaptive form.

On field initialize event in Code editor, below works for me when I submitted the form without entering any data.

this.mandatory="true";

Translate
Level 2
Apr 20, 2023 12:49 PM UTC

This unfortunately does not work for me.  When I submit the form, it's not respecting this change.  I've tried mandatory="true" on the outer div element surrounding the form component as well as on the radio button group itself.

Translate