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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T23:13:07+00:00 2026-06-13T23:13:07+00:00

I’m looking for a way to make JQuery UI DatePicker to allow setting the

  • 0

I’m looking for a way to make JQuery UI DatePicker to allow setting the date to any arbitrary string, including an invalid date. I need this to give user a chance to change the date he may manually enter, in case this date was in an incorrect format

Steps:

  • the user manually enters the incorrect date 28/13/2012 (date format is dd/mm/yy, month 13 is invalid)
  • the user validates the form
  • struts2 displays the same form again with a message

Expected: On page redisplay, field is filled with 28/13/2012 and a message “incorrect date format”

Actual: The field gets becomes empty

Would’nt it be better for user to get his old incorrect value 28/13/2012? How can we achieve this?

Thanks


Addition:

JSP code:

<s:textfield name="fromDate" cssClass="datePicker" theme="simple"/>
<s:textfield name="toDate" cssClass="datePicker" theme="simple"/>

JS code:

$(document).ready(function(){
    $('input.datePicker').datepicker({
        autoSize: true,
        dateFormat: '<s:text name="date.datePicker.dateFormat"/>',
        showOtherMonths: true,
        selectOtherMonths: true,
        changeMonth: true,
        changeYear: true,
        numberOfMonths: 3,
        dayNamesMin: '<s:text name="date.datePicker.dayNamesMin"/>',
        monthNamesShort: '<s:text name="date.datePicker.monthNamesShort"/>'
    });

    // Gestion du la dépendance entre date de début et de fin
    $('input[name="fromDate"]').datepicker( "option", "onClose", function( selectedDate ) {
        $( 'input[name="toDate"]' ).datepicker( "option", "minDate", selectedDate );
    });
    $('input[name="toDate"]').datepicker( "option", "onClose", function( selectedDate ) {
        $( 'input[name="fromDate"]' ).datepicker( "option", "maxDate", selectedDate );
    });

});

Java code (Action class):

private String toDate;
private String fromDate;
// + getters and setters
  • 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-13T23:13:07+00:00Added an answer on June 13, 2026 at 11:13 pm

    I finally found a quick quirk to display the old incorrect date

    $(document).ready(function(){
    
        // initialize datepicker
        $('input.datePicker').datepicker({
            autoSize: true,
            dateFormat: '<s:text name="date.datePicker.dateFormat"/>',
            showOtherMonths: true,
            selectOtherMonths: true,
            changeMonth: true,
            changeYear: true,
            numberOfMonths: 3,
            dayNamesMin: <s:text name="date.datePicker.dayNamesMin"/>,
            monthNamesShort: <s:text name="date.datePicker.monthNamesShort"/>
        });
    
        // Do all your JQuery UI datepicker-related stuff here
        // (...)
    
        // force old date. Useful when user types a date with month=13 for exemple
        $('input[name="fromDate"]').val('<s:property value="fromDate" />');
        $('input[name="toDate"]').val('<s:property value="toDate" />');
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a jquery bug and I've been looking for hours now, I can't
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I need to clean up various Word 'smart' characters in user input, including but
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
For some reason, after submitting a string like this Jack’s Spindle from a text
I am reading a book about Javascript and jQuery and using one of the
Configuring TinyMCE to allow for tags, based on a customer requirement. My config is
I've got a string that has curly quotes in it. I'd like to replace
Specifically, suppose I start with the string string =hello \'i am \' me And

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.