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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T03:29:43+00:00 2026-05-24T03:29:43+00:00

<h:inputText id=quantity value=#{_cartItem.quantity} required=true size=3 maxlength=3> <f:converter converterId=ValueConverter /> <f:validateLongRange minimum=0 maximum=999 /> <a:support

  • 0
<h:inputText id="quantity"
value="#{_cartItem.quantity}" required="true" size="3"
maxlength="3">
<f:converter converterId="ValueConverter" />
<f:validateLongRange minimum="0" maximum="999" />
<a:support event="onchange"
    ajaxSingle="true"
    action="#{cSession.userCheckQuantity(_cartItem, index)}"
    reRender="minicartAjax, shoppingCartAjax, orderTotalAjax"></a:support>

When you click off the Quantity input box the userCheckQuantity method is easily fired. But If I put in a number and quickly slam down the enter key on the keyboard the validation is missed.

How can I get the Enter key approach to validate as well? Let me know if I need to provide more code.

  • 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-24T03:29:44+00:00Added an answer on May 24, 2026 at 3:29 am

    You’re doing the validation by Ajax exclusively. This is not robust enough. You need to replace the action="#{cSession.userCheckQuantity(_cartItem, index)}" by a fullworthy Validator implementation which you bind to the input component as a <f:validator>. This way the validation will always take place, regardless of whether it’s been triggered by a change or a form submit.

    Inside the Validator implementation, you could obtain the _cartItem and index from the FacesContext. How exactly depends on where they are stored and what JSF spec version you’re using. If they’re for example stored as request attributes, you could use ExternalContext#getRequestMap() to get them.

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

Sidebar

Related Questions

I have an input field taking an email address: <h:inputText value=#{register.user.email} required=true /> How
I'm using inputText to get input from a user <h:inputText id=firstName value=#{beanManager.currentUser.firstName } required=true
Here's the field: <h:inputText id=mobilePhoneNo value=#{newPatientBean.phoneNo} required=true requiredMessage=Required validator=#{mobilePhoneNumberValidator} validatorMessage=Not valid (validator) converter=#{mobilePhoneNumberConverter} converterMessage=Not
Im trying to use dynamic validationGroups <h:inputText id=id value=#{bean.char} maxlength=8 alt=#{bean.displayName}> <f:validateBean validationGroups=#{bean.validationGroup} />
I have such code: <h:inputText id=input value=#{bean.input}> <f:convertNumber /> <rich:ajaxValidator event=onblur /> </h:inputText> I
I have JSF code like: <h:inputText id=from value=#{fromToMBean.fromName}/> I would like to get this
I'm trying to convert inputText to java.net.URL in JSF page: ... <h:form> <h:inputText value=${myBean.url}
Is it possible to set the maxlength attribute of an <h:inputText> tag to be
I have the follwoing code from Richfaces 3.3 <h:inputText id=transamount value=#{myBean.amount}> <a4j:support event=onkeyup ajaxSingle=true
I have this a field: <h:inputText id=email value=#{user.user.email} title=Email validator=#{user.user.validateEmail} /> The validateEmail method

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.