Expand my Community achievements bar.

SOLVED

Make an Adaptive Form Field required in JavaScript

Avatar

Level 2

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

1 Accepted Solution

Avatar

Correct answer by
Level 8

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

Avatar

Correct answer by
Level 8

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

Avatar

Level 1

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.

Avatar

Level 8

 

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

 

Capture.JPG

 

 

Capture2.JPG

page footer
Change Username