Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8082517
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T17:07:49+00:00 2026-06-05T17:07:49+00:00

Below code not work, but it’s work fine for jsf1.2. Now the framework is

  • 0

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?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T17:07:53+00:00Added an answer on June 5, 2026 at 5:07 pm

    You can use #{component} in any of the component’s attributes to get hold of the concrete UIComponent instance of the current component. This resolves in case of <p:inputText> to an instance of UIInput which in turn has a boolean disabled property. So, this should do:

    <p:inputText id="pInputText4" disabled="true" value="This is Input Text" 
        style="color: #{component.disabled ? '#0f0' : '#f00'};" />
    

    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.

    <p:inputText id="pInputText4" disabled="true" value="This is Input Text" 
        styleClass="foo" />
    

    with

    .foo {
        color: #f00;
    }
    
    .foo[disabled] {
        color: #0f0;
    }
    

    Or if you want to apply this globally on all input elements

    <p:inputText id="pInputText4" disabled="true" value="This is Input Text" />
    

    with

    input {
        color: #f00;
    }
    
    input[disabled] {
        color: #0f0;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The code below does not work but meant to illustrate what I want to
The below code does not work in 'real time'. The intention is, when the
I am not able to have below code working in IE. It works fine
I am using the below code, but I am not getting that why it
How do I use WriteByte? The below code will not work, coming up with
Video tags like below plays fine with iPhone, but not Android: <video id=video width=320
Below is my demo site. http://122.155.10.35/~bkkvoice/ All jQuery script not work but alert() function.
I work on VS 2008 with C#. This below code does not work for
The code below does NOT work: Cause: I assume I tracked down the cause
When i use the below code in webpage (.aspx file), it works fine; but

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.