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
kiransure kumarkiransure kumar 

FIELD UPDATIONS

HI I HAVE TWO CHECK BOXES LIKE FATHER AND HUSBAND .IF I SELECT FATHER CHECK BOX THEN USER SHOULD ENTER FATHER NAME AND I WANT TO DISABLE THAT HUSBAND TEXT FIELD WHILE ENTERING IN FATHER TEXT FIELD .AND SAME IF I SELECT HUSBAND CHECK BOX CORESPONDING HUSBAND TEXT FIELD WILL ENBLE TO ENTER DATA AND WANT MAKE FATHER NAME TEXT FIELD DISABLE .HOW ? CAN ANY ONE HELP ME ?
Best Answer chosen by kiransure kumar
ManojjenaManojjena
Hi KiranSure ,

In this case better if you will write two validation .

One is for  Husband chk box and related  Husbannd Text field Another for father check box with related Father field .

You need validation vice versa like if chk box is checked then text field is mandatory and on reverse if you want to add value to check box then also chk box should clicked .

So better you should write two validation which will help you to display two error message .

Whay validation bcoz your scenario is not possible in standrad page lay out how ever it is possible in custom VF page .
OR(AND(FatherChkBoxAPI==true,ISBLANK(FatherTextApi)),AND(FatherChkBoxAPI==false,NOT(ISBLANK(FatherTextApi))))
	
	OR(AND(HusbandChkBoxApi==true,ISBLANK(HusbandtextApi)),AND(HusbandChkBoxApi==false,NOT(ISBLANK(HusbandtextApi))))

Any issue let us  know .

Thnaks 
manoj

 

All Answers

PratikPratik (Salesforce Developers) 
Hi Kiran,

You can write a validation rule for this:

OR ( AND( fathercheckbox=true , NOT ( ISBLANK(husbandtext) ) ,  AND( husbandcheckbox=true , NOT ( ISBLANK(fathertext) ) )   )

Thanks,
Pratik
ManojjenaManojjena
Hi KiranSure ,

In this case better if you will write two validation .

One is for  Husband chk box and related  Husbannd Text field Another for father check box with related Father field .

You need validation vice versa like if chk box is checked then text field is mandatory and on reverse if you want to add value to check box then also chk box should clicked .

So better you should write two validation which will help you to display two error message .

Whay validation bcoz your scenario is not possible in standrad page lay out how ever it is possible in custom VF page .
OR(AND(FatherChkBoxAPI==true,ISBLANK(FatherTextApi)),AND(FatherChkBoxAPI==false,NOT(ISBLANK(FatherTextApi))))
	
	OR(AND(HusbandChkBoxApi==true,ISBLANK(HusbandtextApi)),AND(HusbandChkBoxApi==false,NOT(ISBLANK(HusbandtextApi))))

Any issue let us  know .

Thnaks 
manoj

 
This was selected as the best answer