+ Start a Discussion
prateek mishraprateek mishra 

picklist vf page rendering issue ... please help me out

User-added image

I want to create a VF page where i have to create a picklist list value. the picklist options contains the short terms of the abbrevations and if i am selecting the one option then the fullform of that should be visible to the next textbox tab.

the fullform box should be only visible only after selecting the value in the picklist value and that should automatically change when i am selecting the different values .
Anil kumar GorantalaAnil kumar Gorantala
<apex:page controller="PickListToFullForm">
    Short form:<apex:selectList size="1" value="{!shortForm}">
        <apex:actionSupport event="onchange" action="{!fillText}" rerender="fullFormText"/>
        <apex:selectOption itemLabel="- - None - -" itemValue="0" ></apex:selectOption>
    	<apex:selectOption itemLabel="C.M" itemValue="1" ></apex:selectOption>
        <apex:selectOption itemLabel="R.O" itemValue="2"></apex:selectOption>
    	Full form:<apex:outputText id="fullFormText" value="{!fullForm}"></apex:outputText>    
public class PicklistToFullForm {
    public integer shortForm{get; set;}
    public String fullForm{get; set;}
    public void fillText(){
        if(shortForm == 1){
            fullForm = 'Crime Management';
            system.debug('inside 1 Shortform is '+shortForm+' FullForm is '+fullForm);
        else if(shortForm == 2){
            fullForm = 'Reporting officer';
            system.debug('inside 2 Shortform is '+shortForm+' FullForm is '+fullForm);

Anil kumar GorantalaAnil kumar Gorantala
small change add else condition in fillText()
fullForm = '';