How to set up a mandatory field based on choice ?

  • 24 August 2016
  • 5 replies
  • 26 views

Badge +6

Hello,

I have some issues with my form.

Goal : I want to set up a mandatory field a dropdown when a specific choice value is selected, same thing when I select another choice.

Context :

My choice control have 2 choices : A and B for example.

In the same repeating section, I have my dropdown(e.g dd) and my textbox (e.g tb).If I chose A, tb is hidden and dd displayed. If I chose B, tb is displayed and dd is hidden.

Can you help me to set up a mandatory rule ?

BR

Théo


5 replies

Userlevel 6
Badge +12

Hello Theo Delsante​ -

This is entirely doable using Nintex Forms and some simple validation rules. I provided an export of what I did so that you can follow along if needed.

First off, I created this on a list with the following columns:

  • Title - not required
  • Choice (Choice field)
    • Dropdown Required
    • Textbox Required
  • Dropdown (Choice Field)
    • A
    • B
    • C
  • Textbox (Single Line Text)

The form will require that a selection is made from Dropdown when "Dropdown Required" is selected from Choice. Conversely, it will require that something be in Textbox if "Textbox Required" is selected from Choice.

I dropped the Dropdown and Textbox controls into panels so that it is easier to manage the rules that are applied to them. On the Dropdown panel, I placed the following rule:

190260_pastedImage_8.png

This will Hide the panel if "Dropdown Required" is not selected. As you can guess, setup a similar rule on the Textbox panel to do the same thing like so:

190261_pastedImage_9.png

This takes care of hiding and showing the controls based on the Choice selection. Now to add in the validations.

Select the Dropdown control and add the following rule:

190262_pastedImage_12.png

This will check Choice to see if it equals "Dropdown Required" AND if Dropdown is empty. If TRUE, it will cause validation and not allow the user to submit:

190263_pastedImage_13.png

Now for the Textbox control. Same approach; select the control and add the following validation rule:

190264_pastedImage_14.png

Again, it will check Choice to see if it equals "Textbox Required" AND if Textbox is empty. If TRUE, it will cause validation and not allow the user to submit:

190265_pastedImage_15.png

From here you can drop these controls into a repeating section and alter the message that will appear.

Hope this helps!

Badge +6

Thank Jesse, I test it tomorrow and I get back to you with my feedback.

Badge +6

It works fine !

Thanks

Théo

Userlevel 6
Badge +12

Excellent  I am glad it worked out for you!

Badge +1

Hi Jesse, 

 

Is this also possible to apply the below to multiple fields dependant on the a choice. This formula has worked for a single field but I am struggling to apply this to multiple fields dependant on choice.

For example, If the choice is made for Textbox Required then a number of Text Boxes would require some input. 

In my scenario, I am creating a digital request form for user management so if the 'New User' selection is made from the Dropdown then I need the 'New User Name' / 'Job Title' / 'Department' / 'Location' fields to be completed. 

Further to this if the selection for 'Change User' is chosen from the Dropdown then 'Existing User Name' / 'Job Title' / 'Department' / 'Location' fields would need to be mandatory etc. 

 

Thank you in advanced. 

Reply