+ Start a Discussion
.Net Api.Net Api 

how to visable false the apex:inputtex when i select the selectlist item .

can u please tell me how to hide the apex:inputtext based on selectlist item values.



Afzal MohammadAfzal Mohammad

You may want to use rendered atrribute on inputtext component.


Your page would have code something like this.



<apex:selectList value="{!country}">
<apex:actionSupport event="onchange" rerender="fieldToRerender"/>
<apex:selectOptions value="{!countries}"/>

<apex:inputfield id='fieldToRerender' value="{!contact.SOME_FIELD__C}" rendered="{!IF(country=='US',true,false)}"/>


Your controller class would have code, something like this.


public String country {set; get}

public List<SelectOption> getcountries() {
List<SelectOption> options = new List<SelectOption>();
options.add(new SelectOption('US','US'));
options.add(new SelectOption('CANADA','Canada'));
options.add(new SelectOption('MEXICO','Mexico'));
return options;


Hope that helps.