I have a form in which there is a selectbox, and a inputtext field with default red color.
I want to change color of inputtextfield when that checkbox is selected.
How can I do that?
I am trying to achieve in this way, but unable to get change color.
pojo:
private Boolean changeColor=false;
private boolean sign1;
public void ChangeColorEvent(){
System.out.println("inside color change event");
changeColor=true;
sign1=true;
}
<h:outputText value="understood and Signed?: " />
<p:selectBooleanCheckbox label="Yes" value="#{patient.sign1}" >
<p:ajax update="hppa1" listener="#{patient.ChangeColorEvent}" />
</p:selectBooleanCheckbox>
<h:panelGroup>
<p:inputText id="hppa" size="5" style="color:White;background:Red;" rendered="#{!patient.changeColor}" />
<p:inputText id="hppa1" size="5" rendered="#{patient.changeColor}" style="color:White;background:Green;"/>
</h:panelGroup>