function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Blue Sky.ax1539Blue Sky.ax1539 

Check box and Text box field dependency

Hi,

 

I have a field with check box. If it is ticked, then the user has to fill the text box, else not required.

How can I configure it ?

 

Your help needed.

 

Regards,

Blue

Best Answer chosen by Admin (Salesforce Developers) 
SabrentSabrent

Text Field: Name__c

ChecklBox: D3__c

 

Create a validation rule -

 

AND(ISBLANK(Name__c), D3__c =true)

 

If the Checkbox is ticked and user doesn't enter anything in textfield, user will get a error. if checkbox is not ticked, it doesn't matter if user enter anything in textfield or not.

 

To create the validation rule, go to the object and click 'New' under the Validation Rule section. Enter the Rule Name, enter the formula I have highlighted above (make sure to replace Name__c and  D3__c with your field names), enter the Error message, and Save.

All Answers

nawazheebanawazheeba

You can use a validation rule as if checkbox is true and textbox is null throw a validation error.

Blue Sky.ax1539Blue Sky.ax1539

Hi,

 

I am not able to understand how to do?

if possible could you please elaborate more...

SabrentSabrent

Text Field: Name__c

ChecklBox: D3__c

 

Create a validation rule -

 

AND(ISBLANK(Name__c), D3__c =true)

 

If the Checkbox is ticked and user doesn't enter anything in textfield, user will get a error. if checkbox is not ticked, it doesn't matter if user enter anything in textfield or not.

 

To create the validation rule, go to the object and click 'New' under the Validation Rule section. Enter the Rule Name, enter the formula I have highlighted above (make sure to replace Name__c and  D3__c with your field names), enter the Error message, and Save.

This was selected as the best answer
Blue Sky.ax1539Blue Sky.ax1539

Thanks, it was a fantastic solution... hats off.

Parmeet Singh 9Parmeet Singh 9
Sir,
I want when I click checkbox then textbox become visible.
in another word, textbox becomes dependent on the checkbox, how I achieve it.