Making a control mandatory on based on other control value

  • 21 August 2015
  • 3 replies
  • 4 views

Badge +6

Hi,

 

On my smartform, I have two controls. Control A of type drop down with Yes and No values, and Control B of type Text. I want to make control B mandatory if yes is selected in control A. 

Appreciate your responses and suggestions

 

Regards,

Ram


3 replies

Badge +9

Ram


 


I believe the best way to do this would be to put a conditional statement on the button, or other control that you are using to submit the formbasically you would first check if the drop down if contains a yes, then you would check to see if the text box is empty. If it is empty, then you would bring up a message for the customer that says that they need to complete the field rather than allowing them to complete the form.


 


Ian

Badge +4

Hi ramkumar,

The best way to approach this, and I think this would fit your requirements is to Hide the TextBox until the Drop Downlist is set to Yes.

Then add calidation on, for example, Button Click, and set up validation to ignore fields which is hidden, this way it will only be validated once it is visible, does this fit your requirement?

Regards
Pieter

Badge +3

Hi Ram,

 

I guess you can hide or disable the control B at initialize.

Then, on change event of dropdown you can check for the value selected, according enable or show control B.

 

Thanks,

Chetan.

Reply