You need to sign in to do that
Don't have an account?
TheRealist
Is it possible to make the checkbox as a dependent field based on a picklist field as controlling field?
Hi
scenario: i have two picklist values A and B in a picklist field as a controlling field and check box as a dependent field,
when A is choosen the dependent check box should be true(should be checked automatically),if B is choosen the check box should be false (unchecked). i wonder if it is possible or not ?
scenario: i have two picklist values A and B in a picklist field as a controlling field and check box as a dependent field,
when A is choosen the dependent check box should be true(should be checked automatically),if B is choosen the check box should be false (unchecked). i wonder if it is possible or not ?
If you want this at organisation level that is for all users them it is better to have a validation rule rather than using apex controller.
You can make it profile specific as well.
Let me know if you need any assistance on that.
Donot forget to select best answer to make our efforts visible in the developer forum.
Please mark this as solution by selecting it as best answer if this solves your problem, So that if anyone has this issue this post can help
All Answers
In standard dependency you can create a check box as a controlling field but not a dependent field .So you can achieve this by creating a formula. and the formula return type will be checkbox . But one thing the check box will not visible in edit page it will only visible in detail page .
Thnaks
Manoj
I tried doing that using below page and custom controller. If 'Yes' is selected and Save is pressed system checks the checkbox and if No is selected and Save is pressed it unchecks the checkbox.
Please let me know if this is of any use.
-----------------------Custom Controller--------------------------------
public class L_CL_InputCheckbox {
string checkVal;
boolean returnval;
//public string checkVal{get;set;}
public string getcheckVal(){
return checkVal;
}
public void setcheckVal(string checkVal){
this.checkVal = checkVal;
}
public PageReference test(){
return null;
}
public boolean getreturnval(){
if (checkVal == 'Yes')
return true;
else return false;
}
public void setreturnval(boolean returnval){
this.returnval = returnval;
}
}
-------------Page code----------------------------------
<apex:page controller="L_CL_InputCheckbox">
<apex:form id="changePrivacyForm">
<apex:selectList multiselect="false" value="{!checkVal}">
<apex:selectOption itemValue="Yes" itemLabel="Yes"></apex:selectOption>
<apex:selectOption itemValue="No" itemLabel="No"></apex:selectOption>
</apex:selectList>
<!--apex:actionSupport event="onselect" action="{!test}" rerender="check"/-->
<apex:commandButton value="Test" action="{!test}" rerender="check" status="status"/>
<apex:pageBlock >
<apex:pageBlock id="check">
<apex:inputCheckbox value="{!returnval}"/>
</apex:pageBlock>
<apex:pageMessages />
</apex:pageBlock>
</apex:form>
</apex:page>
Thanks,
Seema
If you want this at organisation level that is for all users them it is better to have a validation rule rather than using apex controller.
You can make it profile specific as well.
Let me know if you need any assistance on that.
Donot forget to select best answer to make our efforts visible in the developer forum.
Please mark this as solution by selecting it as best answer if this solves your problem, So that if anyone has this issue this post can help
1. If you can do without having the check-box on Edit page, you can configure a formula.
2. If you want the check-box on Edit page, you may configure a workflow field update. Please note that the value selected by user will be overwritten by the field update.
3. Instead of check-box, create a dependent picklist with Yes/No or True/False as values.
4. If you are on VF rather than standard page, a simple actionSupport will do.
-----------------------------------------
If this resolves your problem, please mark the question as Resolved.
thanks everyone of you for your time,all of your answers are very informative but validation rule helped me with my situation that fulfilled my requirement
You are not following his approach so there is no need to worry.
Please select the best answer to make out efforts visible on the forum.
Donot forget to select best answer to make our efforts visible in the developer forum.
Please mark this as solution by selecting it as best answer if this solves your problem, So that if anyone has this issue this post can help