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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T04:59:49+00:00 2026-05-31T04:59:49+00:00

I’m new to JSF and I’m sure I’m doing something stupid, but I’ve been

  • 0

I’m new to JSF and I’m sure I’m doing something stupid, but I’ve been trying different things for days and cant make any progress. I’m trying to do validation when a user types in a date instead of using the rich calendar but for some reason I cant seem to get the validator to fire. The page code is as follows:

<a4j:outputPanel id="responseReleaseDate" rendered="#{appealSearchManager.isVendor}">
    <p><h:outputText value="#{messages.ResponseReleaseDate}"/></p>
    <rich:calendar id="responseReleaseDateBegin" datePattern="MM/dd/yyyy"
        enableManualInput="true"
        buttonIcon="/images/calendar_icon.jpg" buttonClass="calendar"
        validator="#{appealSearchManager.validateResponseReleaseDateBegin}"
        value="#{appealSearchManager.responseReleaseDateBegin}">
    </rich:calendar>
    <rich:calendar id="responseReleaseDateEnd" datePattern="MM/dd/yyyy"
        enableManualInput="true"
        buttonIcon="/images/calendar_icon.jpg" buttonClass="calendar"
        validator="#{appealSearchManager.validateResponseReleaseDateBegin}"
    value="#{appealSearchManager.responseReleaseDateEnd}">
    </rich:calendar>
</a4j:outputPanel>

The bean code I’m trying to invoke is as follows:

    public void validateResponseReleaseDateBegin(FacesContext facesContext, UIComponent uiComponent, Object value) throws ValidatorException {
    SimpleDateFormat simpleDateFormat = new SimpleDateFormat("MM/dd/yyyy");
    if (value != null && !value.equals("")) {
        try {
            simpleDateFormat.parse(value.toString());
        } catch (ParseException e) {
            throw new ValidatorException(new FacesMessage(
                FacesMessage.SEVERITY_ERROR,
                MessageFormat.format((RootUtils.getCommonBundle().getString(BundleConstants.INVALID_ITEM)), "Response Release Date"),
                MessageFormat.format(RootUtils.getCommonBundle().getString(BundleConstants.INVALID_DATE_FORMAT), "Date", "MM/DD/YYYY")));

        }
    }
}

The wierd thing is that I can reach the validateResponseReleaseDateBegin(…) method using the code below (I know, it doesnt make sense for a text field, it was just for testing purposes). But I never hit the method when I enter input for the rich calendar.

<div class="div30">
    <p><h:outputText value="#{messages.ProgramInvoiceId}"/></p>
    <h:inputText id="programInvoiceId"
        validator="#{appealSearchManager.validateResponseReleaseDateBegin}"
        value="#{appealSearchManager.programInvoiceId}"/>
</div>

Any ideas why this validator works in one place and not another?

Thanks!

  • 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-31T04:59:50+00:00Added an answer on May 31, 2026 at 4:59 am

    This makes no sense. The <rich:calendar> will already implicitly convert the String submitted value to Date before setting it as model value. If you enter a date in invalid format, the <rich:calendar> will already throw a ConverterException for that. Its message should already be visible in any <h:messages> or <h:message> component associated with the component.

    As conversion runs before validation, your validator is never fired when conversion fails. Even when your validator was fired, the Object value argument in the validator is already of the type java.util.Date. So if your validator was fired, it would always have thrown an exception because Date#toString() does definitely not match MM/dd/yyyy.

    I’m not sure why you need this validator. Perhaps you just wanted to supply a custom conversion error message? In that case, you should be using its converterMessage attribute instead.

    <rich:calendar ... converterMessage="Invalid date" />
    

    Or, if you really need to “validate” the date format by yourself, implement a custom Converter instead and register it by converter attribute or <f:converter> tag instead.

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

Sidebar

Related Questions

I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have a jquery bug and I've been looking for hours now, I can't
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
Seemingly simple, but I cannot find anything relevant on the web. What is the
I want use html5's new tag to play a wav file (currently only supported
I am doing a simple coin flipping experiment for class that involves flipping a
I am trying to render a haml file in a javascript response like so:

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.