Make an Adaptive Form Field required in JavaScript | Community
Skip to main content
Level 2
April 17, 2023
Solved

Make an Adaptive Form Field required in JavaScript

  • April 17, 2023
  • 2 replies
  • 828 views

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.
Best answer by Vijay_Katoch

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";

2 replies

Vijay_Katoch
Community Advisor
Vijay_KatochCommunity AdvisorAccepted solution
Community Advisor
April 18, 2023

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";

Level 2
April 20, 2023

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.

Vijay_Katoch
Community Advisor
Community Advisor
April 20, 2023

 

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