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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T00:13:00+00:00 2026-05-18T00:13:00+00:00

A very simple JSF applicaton: InputText element is assigned with Validator. f:ajax is used

  • 0

A very simple JSF applicaton:

  • InputText element is assigned with Validator.
  • f:ajax is used to render next element (phoneNumber) by using blur event.
  • PhoneNumber will only be displayed if inputText pass the validator and isValid boolean value is set to true

Here is the code snippet

<h:form id="invOrdersWizForm">                                  
    <h:inputText id="name" maxlength="9" styleClass="ordLabelNarrow"
        validator="#{person.validatePerson}"                                
        value="#{person.name}">
        <f:ajax render="phoneLabel" event="blur"/>                                                              
    </h:inputText>  
    <h:outputText id="phoneLabel"
        rendered="#{person.isValid}"                        
        styleClass="ordLabelWide" value="#{person.phoneNumber}" />
</h:form>

ManagedBean

public void validatePerson(FacesContext context, UIComponent toValidate, Object value) {
    name = ((String) value).toUpperCase();
    phoneNumber = "12345678";
    isValid = true;
}

The problem is, for some reason, the phoneNumber is not rendered at all.

The only way that I can make it work is by changing f:ajax to render @form

<h:inputText id="name" maxlength="9" styleClass="ordLabelNarrow"
    validator="#{person.validateSecurityCode}"                              
    value="#{person.name}">
    <f:ajax render="@form" event="blur"/>                                                               
</h:inputText>  

Or remove rendered from phoneNumber

    rendered="#{person.isValid}"

For some reason f:ajax with specific element Id and rendered based on managedBean Attribute cannot co-exist.

Any idea or advice guys?

NOTE: this behaviour also happen when I use listener instead of validator

  • 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-05-18T00:13:01+00:00Added an answer on May 18, 2026 at 12:13 am

    The f:ajax operates at the client side. The element which is specified in render must be already present in the client side HTML DOM tree. Put it in for example a h:panelGroup instead which is always rendered to the client side.

    <h:panelGroup id="phoneLabel">
        <h:outputText rendered="#{person.isValid}" value="#{person.phoneNumber}" />
    </h:panelGroup>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a very simple JSF form: <h:form id=simpleSearch> <h:inputText id=surname value=#{myBean.surname} required=true />
I need to do very simple thing - pass current URL from JSF (2.0)
I recently discovered this very useful Netbeans tutorial for creating a simple JSF 2
I have a very simple JSF 2.0 project. I have an index.xhtml file to
I am trying to deploy a very simple & my first JSF application (following
I am making a very simple datatable with JSF 2.0 tag dataTable but for
My problem is that when I run a very simple JSF application the EL
I have a very specific questions about using JSF and component libraries. I tested
Very simple + silly question: Does clojure provide multi maps? I currently have something
Very simple question... I have an array of pixels, how do I display them

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.