You need to sign in to do that
Don't have an account?
krish@123
Based on multi-picklist values display another picklist and textbox.............. Please very urgent
Hi
Please suggest me how to display picklist field and textbox on selection of values in muti-picklist field
and if I selected two values at at a time in mutlpicklist field then how could be displayed both fields(picklist and textbox) in visualforce page
Please post sample code if you have
its very urgent
Thanks
Please suggest me how to display picklist field and textbox on selection of values in muti-picklist field
and if I selected two values at at a time in mutlpicklist field then how could be displayed both fields(picklist and textbox) in visualforce page
Please post sample code if you have
its very urgent
Thanks
Can you try something like (I have not tried but seems may work)-
Instead of -
<apex:inputField value="{!cc.test1__c}" id="textpop" rendered="{!picklst}"/>
Try this -
<apex:inputField value="{!cc.test1__c}" id="textpop" rendered="{!IF(CONTAINS(cc.multipicklist__c,cc.test1__c),TRUE,FALSE)}"/>
or its equivalent -
<apex:inputField value="{!cc.test1__c}" id="textpop" rendered="{!CONTAINS(cc.multipicklist__c,cc.test1__c)}"/>
Also, if it does not work (because cc.multipicklist__c is of type Object and not String) try storing the values in some String properties (String str1 having the value of cc.multipicklist__c) and using them on the page directly. If it works, you may also get rid of the redundant method created for these checks.
All Answers
Below is the sample code which dynamically changes the field values according to the picklist selections
In this link you can create a text box
http://www.forcetree.com/2009/06/dynamically-add-values-to-picklist.html
Best Regards
Naga Kiran
Have a boolean in controller to use in rendered attribute.
Multi-Picklists return results in semi-colon separated values like - abc;xyz;pqr
Split the value on ; character and do the checks using String contains method in the controller.
Please find the below code
In mutipicklist Field in that I have 5 values(Yes,No ,Other ,sample,test)
and 5 input fields(test1__c,test2__c,test3__c,test4__c,test5__c)
I have selected two values at a time(Yes,No) so below code is wroking fine .But if I need to select more than two values in muti picklist field
how to display?
Please suggest me........
<apex:page standardController="Contact" extensions="multi">
<Apex:form id="form1">
<apex:pageBlock id="block1">
<apex:pageBlockSection >
<apex:actionRegion >
<Apex:inputField value="{!cc.multipicklist__c}" id="populate">
<apex:actionSupport event="onchange" reRender="block1" action="{!Multipicklist}"/>
</apex:inputfield>
</apex:actionRegion>
</apex:pageBlocksection >
<apex:pageBlockSection>
<apex:inputField value="{!cc.test1__c}" id="textpop" rendered="{!picklst}"/>
<apex:inputField value="{!cc.test2__c}" rendered="{!picklst1}"/>
<apex:inputField value="{!cc.test3__c}" rendered="{!picklst2}"/>
<apex:inputField value="{!cc.test4__c}" rendered="{!picklst3}"/>
<apex:inputField value="{!cc.test5__c}" rendered="{!picklst4}"/>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>
public class multi {
public contact cc{set;get;}
public Boolean picklst{get;set;}
public Boolean picklst1{get;set;}
public Boolean picklst2{get;set;}
public Boolean picklst3{get;set;}
public Boolean picklst4{get;set;}
public multi(ApexPages.StandardController controller) {
cc = new contact();
picklst =false;
picklst1 =false;
picklst2 =false;
picklst3 =false;
picklst4 =false;
}
public void Multipicklist()
{
//string[] regions = cc.multipicklist__c.split(';',0);
if(cc.multipicklist__c == 'Yes')
{
picklst =true;
picklst1 =false;
}
else if(cc.multipicklist__c == 'No')
{
picklst1 =true;
picklst =false;
}
else if(cc.multipicklist__c == 'Yes;No')
{
picklst =true;
picklst1 =true;
}
else
{
picklst =false;
picklst1 =false;
}
}
}
Thanks
Can you try something like (I have not tried but seems may work)-
Instead of -
<apex:inputField value="{!cc.test1__c}" id="textpop" rendered="{!picklst}"/>
Try this -
<apex:inputField value="{!cc.test1__c}" id="textpop" rendered="{!IF(CONTAINS(cc.multipicklist__c,cc.test1__c),TRUE,FALSE)}"/>
or its equivalent -
<apex:inputField value="{!cc.test1__c}" id="textpop" rendered="{!CONTAINS(cc.multipicklist__c,cc.test1__c)}"/>
Also, if it does not work (because cc.multipicklist__c is of type Object and not String) try storing the values in some String properties (String str1 having the value of cc.multipicklist__c) and using them on the page directly. If it works, you may also get rid of the redundant method created for these checks.
rendered="{!IF(CONTAINS(cc.multipicklist__c,cc.test1__c),TRUE,FALSE)}"/>
Now iam able to display textboxes based on multipicklist values selection