+ Start a Discussion
SharathChandraSharathChandra 

Help Me

<apex:page controller="selectionController" >
<apex:form >
<apex:actionFunction name="rerenderText" reRender="ot" >
<apex:param value="" assignTo="{!selectedValue}" name="param"/>
</apex:actionFunction>
<apex:selectList id="sL"  size="1" onchange="rerenderText(this.value); alert(this.value);">
<apex:selectOption itemLabel="1" itemValue="One"></apex:selectOption>
<apex:selectOption itemLabel="2" itemValue="Two"> </apex:selectOption>
<apex:selectOption itemLabel="3" itemValue="Three"> </apex:selectOption>
</apex:selectList><br/>
<apex:outputText value="Success" rendered="{!selectedValue=='Two'}" id="ot"></apex:outputText>
</apex:form>

</apex:page>

--------------------

class

 

public class selectionController {
public String selectedValue{get; set;}

}

Here i want to rendered outputText when the selectedValue is 'Two'.

Best Answer chosen by Admin (Salesforce Developers) 
Abhay AroraAbhay Arora

Hi ,

 

Use action support for this in my below example the AccountSource is a picklist so it renders a Selectbox as you need please mark solved if it solves your problem

<apex:page id="thepage" standardController="Account" extensions="testComponent">
<apex:form >
    <apex:inputField value="{!acc.AccountSource}">
        <apex:actionSupport event="onchange" action="{!changeCheckBox}" rerender="pan" status="counterStatus" />
    </apex:inputField>
            <apex:outputPanel id="pan">
            <apex:inputField id="test" value="{!acc.check__c}"/>
        </apex:outputPanel>
        <apex:actionStatus id="counterStatus" startText=" (incrementing...)" stopText=" (done)"/>
</apex:form>
</apex:page>
             

public with sharing class testComponent {

    public testComponent() {

    }

    public Account acc{get;set;}
    public testComponent(ApexPages.StandardController controller) {
        //acc=(account)controller.getrecord();
//        string accid=(account)controller.getrecord().id;
        acc=[select id,AccountSource,check__c from account where id='0019000000CJ6QZ'];
    }
    public pagereference changeCheckBox(){
        acc.check__c=true;
        return null;
    }

}