Need a form field to be required dependent on value of other field | Community
Skip to main content
Mary_Skuse
New Participant
January 14, 2021
Solved

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

  • January 14, 2021
  • 1 reply
  • 2437 views

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.

Best answer by SanfordWhiteman

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.

1 reply

SanfordWhiteman
New Participant
January 14, 2021

To be clear, two Text type fields?

Mary_Skuse
New Participant
January 14, 2021

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

SanfordWhiteman
SanfordWhitemanAccepted solution
New Participant
January 15, 2021

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.