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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T03:06:25+00:00 2026-05-28T03:06:25+00:00

I am having a problem with an ajax behavior event not being fired immediately

  • 0

I am having a problem with an ajax behavior event not being fired immediately as text is typed in a field.

If the field is a String no problem, but I am using a Date.

xhtml:

<h:outputLabel value="Date of Birth:" />
<h:inputText id="searchDOB" value="#{search.dob}" required="true">
  <f:ajax event="keyup" listener="#{search.addHyphensToDOB}" render=":output" />
  <f:convertDateTime pattern="dd-MMM-yyyy" />

bean:

Date dob;

public void addHyphensToDOB(AjaxBehaviorEvent abe) {
  System.out.println("addHyphen");
}

The event is only fired after typing the following:

22-JAN-

And fires on any number after the second hyphen, but not before.

One solution could be to change the Date type to a String, then format without using converter, but I would like to keep the Date type.

Any suggestions, thanks.

Eclipse 3.7, tomcat 7, jsf2.1,

  • 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-28T03:06:26+00:00Added an answer on May 28, 2026 at 3:06 am

    It’s not fired because a conversion error has occurred due to invalid date format. The submitted value is converted everytime before the bean listener method is hit. Add a <h:message>/<h:messages> and include its ID in <f:ajax render>. You’ll then see it.

    A String value of for example 2 can impossibly represent a valid Date object when parsed with the pattern dd-MMM-yyyy.

    You’ll really need to keep it a String if you want to achieve the functional requirement this way. As a completely different alternative, you could consider to do it entirely at the JavaScript side without sending JSF ajax requests.

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

Sidebar

Related Questions

I'm having a problem similar to jQuery $.ajax Not Working in IE8 but it
I'm having this problem with my AJAX, where it's not working in IE, but
I am having problem in getting reference of Ajax control extender using $find() or
I am creating a jquery ajax popup comment form, but am having a problem
I'm having a problem with jQuery/Ajax/JSON. I'm using a jQuery ajax post like so...
I am using the ASP.NET AJAX Control Kit and I am having a problem
I am having problem with jquery that the ajax call is not made. Also
I am having a problem checking if a file exists using $.ajax(). I am
Having problem with the middle Div not expanding to the width http://acs.graphicsmayhem.com/images/middiv.jpg Ok, how
I'm having problem restricting a query in mdx, using except function at where clause.

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.