Hi i need some help. I am developing a java web application using jsf (front-end) and primefaces.
I have a drop down list in my .xhtml page containing Car,Bus,Other. On clicking 'Other', i want a text box to appear.Can you advice me how to do it?
i have a java interface and its implementation. i can call the interface from my .xhtml. Normally my dropdownList is like this in my .xhtml:
<h:selectOneMenu id="reason"
value="#{reasonComponent.reason.mscReason}"
label="reason_mscReason">
<f:selectItem itemLabel="Car" itemValue="Car" />
<f:selectItem itemLabel="Bus" itemValue="Bus" />
<f:selectItem itemLabel="Other" itemValue="Other" />
</h:selectOneMenu>
this code :
reasonComponent.reason.mscReason
is refering to the field name in database.
i modify the value to
value="#{reasonComponent.dropDownList}"
the dropDownList is a String in my interface with its getter and setter. I dont know how to link it with the text box which i want to be displayed.Well according to me, the variable dropDownList will get the value of drop-down list reason,then i will be able to link it with the textbox. is it the right way or is there any other ways of doing this? code below is for textbox:
<h:inputText id="reasonapplication_other"
value="#{reasonComponent.reason.other}"
required="false" maxlength="50" />
Thanks. I will wait for a reply :)