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

  • Home
  • SEARCH
  • 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 9259051
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T12:33:46+00:00 2026-06-18T12:33:46+00:00

Inside an input type field I have a value binding to a variable(lets call

  • 0

Inside an input type field I have a value binding to a variable(lets call foo) of type double for the value property in my jsp . I have a setter and a getter for foo and there is also a ValueChangedListener registered for this input . The autosubmit attribute of that field is set to true . When the user clears the input and navigates to the next field ,the code inside valueChangedListener gets invoked and the newValue of the ValueChangedEvent is coming null . How can I prevent this ?

I tried handling this from the setter method but it seems the setter is not getting called and the valueChangedListener is getting called first . Doesn’t the spec say that setter should be called first to populate the user edited value to the component and then only the ValueChangedListener gets fired ?

P.S: I am using ADF RichInputText as the input but I think it is not related to ADF but to core JSF machinery. Hence not tagging it as ADF question.

  • 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-18T12:33:48+00:00Added an answer on June 18, 2026 at 12:33 pm

    I need to validate the new value and I am not interested in the old value.

    A valueChangeListener is then the wrong tool for the job. Use a normal Validator. In order to validate empty but required fields, use required="true". In order to skip custom validators on empty fields, add the following context param to web.xml:

    <context-param>
        <param-name>javax.faces.VALIDATE_EMPTY_FIELDS</param-name>
        <param-value>false</param-value>
    </context-param>
    

    The only disadvantage is that this will also skip @NotNull/@NotBlank JSR303 bean validation, but that shouldn’t harm if you aren’t using it anyway.


    Also why the setter won’t be called before the valueChangeListener?

    Because the old value is otherwise lost and this would defeat the purpose of the value change listener.


    Will the validator run before the valueChangedListener ? I guess only when validation passes , it should invoke a ValueChangedEvent , right ?

    That’s correct. The value change listener is only invoked when the component has passed validation (i.e. UIInput#isValid() returns true). Noted should be again that when you’re not interested in the old value, the value change listener is most likely the wrong tool for the job you had in mind.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an ASP.NET Webform and inside the form I have an input type
I have the below code in my .aspx page. <input type=hidden id=fbinfo name=fbinfo value=
I have a simple form and inside there are two input fields text type.
I have a simple input field inside a form tag: <body> <form action=#> <label>Input</label>
I have to design a form with an input inside it. I use background
I'm trying to modify this: jquery desktop by adding a input field inside one
Im having issues vertically positioning text inside of a text input field in Firefox.
dear all..i have a textfield <tr> <td> <td><input type=text id=model_name></td> </td> </tr> and a
I have a form , with a couple of <input> tags inside. I have
I have in my view Datetime fied like these @Html.EditorFor(m => m.StartDate) <input type=button

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.