+ Start a Discussion
udayar_jayamudayar_jayam 

Can a textbox be enabled after a certain value from a picklist is selected.

Hi All,

   In Opportunity object Can a textbox be enabled (made visible) after a certain value from a picklist is selected, such as "Other"?  This will allow the user to define a reason for this value.  If so, how would I accomplish this? Im using PE

SurekaSureka

Hi,

 

You cannot make a text field visible after selecting "Other" in the picklist field out of the box. 

 

Workaround is, have the picklist and text field. Have a validation rule mandating the text field when "Other" is selected.

 

Hope this helps.

 

Thanks

udayar_jayamudayar_jayam

 thanks for reply

If i select "other" then the text must be editiable. If i select web or mail then the textbox must in uneditiable mode.how to write validation rule for this issue

SurekaSureka

Hey,

 

Have a vice versa validation rule. ie. If the picklist != 'other' and the text box is filled, throw the validation rule.

udayar_jayamudayar_jayam

If i select "other" then the text must be editiable. If i select web or mail in picklist then the textbox must in uneditiable mode(user cannot write anything in this textbox).how to write validation rule for this issue

 

AND(ISPICKVAL( sector__c, "other"), ISBLANK(textbox__c)) 

SurekaSureka

You would need to write two validation rules:

 

AND(ISPICKVAL( sector__c, "other"), ISBLANK(textbox__c)) 

 

AND(AND(ISPICKVAL( sector__c, "val1"),ISPICKVAL( sector__c, "val2")), NOT(ISBLANK(textbox__c))) 

vmanumachuvmanumachu

If you are using VF, then you can use 'rendered' attribute on the text box. Something like below

 

<apex:inputText value ={} rendered = {!sObject.FieldName != 'Other'}

 

This will make sure that the textbox is rendered only if the value of the picklist is Other

udayar_jayamudayar_jayam

thank u vmanumachu

 

I have tried this code in my PE but not working.When i tried the same code in DE it is working.i workaround but i can any solution plz look at this code .

<apex:page standardController="Account">
    <apex:form >
    <apex:pageBlock >
        <apex:pageBlockButtons >
            <apex:commandButton action="{!save}" value="Save"/>
        </apex:pageBlockButtons>
        <apex:pageBlockSection >
            <apex:pageBlockSectionItem >
                <apex:inputField value="{!Account.type}">
                    <apex:actionSupport event="onchange" rerender="conditionalEntryFieldDiv"/>
                </apex:inputField>
            </apex:pageBlockSectionItem>
            <apex:pageBlockSectionItem >
                <apex:outputPanel layout="block" id="conditionalEntryFieldDiv">
                    <apex:inputField value="{!Account.accountnumber}" rendered="{!Account.type == 'Prospect'}"/>
                    <apex:outputField value="{!Account.accountnumber}" rendered="{!Account.type != 'Prospect'}"/>
                </apex:outputPanel>
            </apex:pageBlockSectionItem>
        </apex:pageBlockSection>
    </apex:pageBlock>
    </apex:form>
</apex:page>

 

pavan kumar 177pavan kumar 177

I think it's work fine.Please change the code based on our requirement @udayar_jayam

<apex:page standardController="Opportunity">
    <apex:form >
    <apex:pageMessages id="theMessage"/>
                 <apex:pageBlock id="thePageBlock">
                          <apex:pageBlockSection columns="2">
                                  <apex:actionRegion >
                                      <apex:inputfield value="{!Opportunity.Type}" id="Type">
                                      <apex:actionSupport event="onchange" rerender="ProdFamilyModel,theMessage"/> 
                                      </apex:inputfield>
                                  </apex:actionRegion>
                                      <apex:inputfield value="{!Opportunity.LeadSource}"/> 
                          </apex:pageBlockSection>
                                <apex:outputPanel id="ProdFamilyModel">
                      <apex:pageBlockSection columns="2" id="ProdFamily"  rendered="{!IF(Opportunity.Type == 'New Customer', true, false)}"> 
                            <apex:inputfield value="{!Opportunity.LeadValue__c}"/>
                 </apex:pageBlockSection> 
    </apex:outputPanel> 
    </apex:pageBlock>
    </apex:form> 
</apex:page>