Need a form field to be required dependent on value of other field | Community
Skip to main content
Mary_Skuse
Level 2
Jan 14, 2021 4:05 PM UTC
Solved

Need a form field to be required dependent on value of other field

I'm creating a form where I need the lead to fill out at least one of two fields. Is there a way to make them required based on the value of the other field? For example, they need to give us value A and/or value B.

SanfordWhiteman
SanfordWhitemanAccepted solution
Level 10
Jan 15, 2021 6:43 AM UTC

Use the code from the JS pane at

 

MktoForms2 :: Min/Max Filled

 

Just set the field names, the min/max non-empty fields (min of 1 and max of Infinity in the case you described), and error message, as in the demo.

3 replies

SanfordWhiteman
Level 10
Jan 14, 2021 5:47 PM UTC

To be clear, two Text type fields?

Translate
Mary_Skuse
Level 2
Jan 14, 2021 7:16 PM UTC

They are Number fields. We also use Salesforce if that makes any difference.

Translate
SanfordWhiteman
SanfordWhitemanAccepted solution
Level 10
Jan 15, 2021 6:43 AM UTC

Use the code from the JS pane at

 

MktoForms2 :: Min/Max Filled

 

Just set the field names, the min/max non-empty fields (min of 1 and max of Infinity in the case you described), and error message, as in the demo.

Translate