Below code not work, but it’s work fine for jsf1.2.
Now the framework is jsf2.0 and primefaces 3.2
<p:inputText id="pInputText4" disabled="true" value="This is Input
Text" style="color:
expression((this.disabled==true)?'#0f0':'#f00');"/>
I have another question that why
<p:selectOneMenu id="roleId" value="#{accessPage.roleId}" required="true">
<f:selectItem itemLabel="#{msg['label.common.selecthere']}" itemValue="#{null}" />
<f:selectItems var="code" value="#{accessPage.roleIdList}"
itemLabel="#{code.codeDesc}" itemValue="#{code.codeId}" />
<f:valueChangeListener type="com.ncs.caseconnect.base.app.utils.ValueChangeCleanUtils"/>
<p:ajax listener="#{accessPage.roleOrModuleChanged}" update="accessRight" />
</p:selectOneMenu>
the valueChangeListener and ajax not work when we select the first null option. If we remove the required attribute it works fine. Is it conflict between required and valueChangeListener?
You can use
#{component}in any of the component’s attributes to get hold of the concreteUIComponentinstance of the current component. This resolves in case of<p:inputText>to an instance ofUIInputwhich in turn has aboolean disabledproperty. So, this should do:But a better practice is to define styling in a CSS file instead of straight in the markup as it eliminates duplication and maintenance headache.
with
Or if you want to apply this globally on all input elements
with