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

The Archive Base Latest Questions

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

I have specific use case for JSF validation. For example I have an inputText

  • 0

I have specific use case for JSF validation. For example I have an inputText field:

<p:inputText id="input" required="#{myBean.required}" value="#{myBean.value}" maxlength="20" disabled="#{myBean.disabled}">
  <p:ajax event="blur" process="@this" update="name" listener="#{myBean.listener}"/>
</p:inputText>

Value of input is number (in some cases it can also be a string, because this is part of composite component, but problem is better described if we assume this is a number). This input is part of the form, at the end of form I have submit button:

<p:commandButton value="Save" actionListener="#{myBean.save}"/>

What are my requests:

  1. When submit button is pressed all validation should be processed and this is OK, this works fine.
  2. When blur event is fired on input field if field is not empty a number validation should be processed, and this is also OK. At the end I update field with id name with some value.
  3. Now I have a problem. My third request is when input is empty validation on input should not be processed. This is special case in which I will clear field with id name. This is also case when i remove text which is already entered in input, remove focus from component (press TAB for example) and in that case AJAX request should also be processed and name input will also be cleared.

How I can disable validation of this input field in case when it is empty, and just for this ajax event?

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

    Let the input’s required attribute check if the save button is pressed or not (which can be identified by the presence of its client ID in the request parameter map).

    <h:form>
        <p:inputText ... required="#{not empty param[save.clientId] and myBean.required}" />
    
        <p:commandButton binding="#{save}" ... />
    </h:form>
    

    (note: do not bind it to a bean property! the code is as-is)

    This way it would only evaluate true when the save button is actually pressed.

    Or, if you have problems with binding and/or don’t have a problem hardcoding the button’s client ID:

    <h:form id="formId">
        <p:inputText ... required="#{not empty param['formId:buttonId'] and myBean.required}" />
    
        <p:commandButton id="buttonId" ... />
    </h:form>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this use case that is very similar to the robot-legs example of
My specific use case is that I have a WYSIWYG editor which is basically
I have a use case where I need to scramble an input in such
i have application who use specific process during running and i want to sample
I have a specific question, that could use a general answer... When building Multi-Tier
All, I have my application setup so that i can use a specific username
We have a simple requirement to use https for certain specific pages in a
Why I have to use Object[] to print the list if I select specific
The use case is that I have a remote (read slow) database from which
We have the use case that we need to output text that is 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.