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 7952177
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T02:46:58+00:00 2026-06-04T02:46:58+00:00

We have a multi field validator with field across two DIVs ,if we try

  • 0

We have a multi field validator with field across two DIVs ,if we try to bind value across the fields and pass it as attributes to one of the validator ,it doesn’t get the submitted value….The field phone 3 got a validator ,but when it goes to validator the submitted value is coming as null.

I have three divs “phone1” , “phone2” , “phone3” ,I would like to validate in the field “phone3” across these three fields. The validator doesn’t get the submitted values of left and middle fields .I added the extra input field “confirm” inside the div “phone3” and the validtor gets the value of the “confirm” field

<div class="home_phone">

        <div id="phone1" >
        <div class="left"></div>
        <div class="middle">
            <h:inputText id="phonePrefix"
                maxlength="4" value="#{phoneNumberTO.phonePrefix}"
                immediate="true"
                binding="#{phonePrefix}">
            </h:inputText>
        </div>
        <div class="right"></div>

</div>
        <div id="phone2" >


        <div class="left"></div>
        <div class="middle">
            <h:inputText  id="phoneAreaCode"
                maxlength="4" 
                immediate="true"
                binding="#{phoneAreaCode}">
            </h:inputText>
        </div>
        <div class="right"></div>
</div>
        <span class="sep_field">-</span>
        <div id="phone3" >

        <div class="left"></div>
        <div class="middle">
            <h:inputText  id="input3"
                maxlength="4" value="#{phoneNumberTO.phoneSuffix}"
                >
                <f:validator validatorId="phoneValidator"  />
                <f:attribute name="phonePrefix" value="#{phonePrefix}"   /> 
             <f:attribute name="phoneAreaCode" value="#{phoneAreaCode}"   />
                             <f:attribute name="confirm" value="#{confirm}"   />
            </h:inputText>
             <h:inputSecret id="confirm" binding="#{confirm}" required="true" />
        </div>
        <div class="right"></div>

</div>



    </div>
  • 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-04T02:46:59+00:00Added an answer on June 4, 2026 at 2:46 am

    I used immediate=true on the first two components. Otherwise it would be validated and submittedValue becomes NULL

    No, this is not what immediate="true" is for. Remove it.

    In JSF, components are processed and converted/validated in the order as they appear in the JSF component tree. Every single input component is step-by-step converted and validated during Validations Phase as follows:

    • Get component’s submitted value by UIInput#getSubmittedValue()
    • Convert component’s submitted value to temp value.
    • Validate temp value.
      • If validation succeeds, store temp value as component’s value by UIInput#setValue() and set the component’s submitted value to null by UIInput#setSubmittedValue().
      • If validation fails, discard the temp value and set the component invalid by passing false to UIInput#isValid(). Note that the submitted value is kept on the component!

    In the order as you have it in your view, with the validator on the last component, you should be collecting values of other inputs by UIInput#getValue() instead of UIInput#getSubmittedValue(), otherwise you will indeed keep getting nulls when the validation has succeed for them.

    UIInput phonePrefix = (UIInput) component.getAttributes().get("phonePrefix");
    Object value = phonePrefix.getValue(); // Don't use getSubmittedValue().
    

    As of now I can’t explain why it worked when you have put them outside the divs. I think that you have actually accidently rearranged the order of the components.


    As to the proper usage of immediate="true" attribute, it should help if you understand what exactly it does. Here’s an extract of relevance from the debug JSF lifecycle article:

    Okay, when should I use the immediate attribute?

    If it isn’t entirely clear yet, here’s a summary, complete with real world use examples when they may be beneficial:

    • If set in UIInput(s) only, the process validations phase will be taken place in apply request values phase instead. Use this to prioritize validation for the UIInput component(s) in question. When validation/conversion fails for any of them, the non-immediate components won’t be validated/converted.

    • If set in UICommand only, the apply request values phase until with update model values phases will be skipped for any of the UIInput component(s). Use this to skip the entire processing of the form. E.g. "Cancel" or "Back" button.

    • If set in both UIInput and UICommand components, the apply request values phase until with update model values phases will be skipped for any of the UIInput component(s) which does not have this attribute set. Use this to skip the processing of the entire form expect for certain fields (with immediate). E.g. "Password forgotten" button in a login form with a required but non-immediate password field.

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

Sidebar

Related Questions

I have a form with multi-value fieldset with each field wrapper and interior divs
I have a multi value cck field. I can read any single id with
I have a multi-value cck field in a drupal node. The field is called
I have a large multi-directional form that validates almost all fields with Jquery Validator,
I have a set of Solr documents containing (among other fields) multi-value fields with
I have a schema containing a multi-value field of type component link. How can
I'm using 'rails3-jquery-autocomplete' gem, but it doesn't have multi column search, but there is
I am using jquery validation plugin to validate my form. I have one field
I'm using CCK Image field (multi-images) and for each image I have the Description
I'm stuck with a database which is using multi-field primary keys. I have a

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.