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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T17:10:20+00:00 2026-06-15T17:10:20+00:00

I am trying to validate the two input boxes where the user selects a

  • 0

I am trying to validate the two input boxes where the user selects a date – i’ve managed to get far as restricting the user to select a previous date and if they select the first textbox as today’s date the next input box must be one day ahead (future date)

On submit i am trying to get it to validate so if you dont select one of the input boxes it gives you an error message.

<asp:Label ID="lblPickupDate" runat="server" Text="Pick-up Date" CssClass="lblPickup"></asp:Label>
<input type="text" class="datePicker" id="validBeforeDatepicker" value="Please select a date" name="pickupdate" /> <span class="ui-icon ui-icon-calendar"></span>

<asp:Label ID="lblReturnDate" runat="server" Text="Return Date" CssClass="lblReturnDate"></asp:Label>
<input type="text" class="datePicker" id="validAfterDatepicker" value="Please select a date" name="returdate" /> <span class="ui-icon ui-icon-calendar"></span>

$(function () {
    $("#validBeforeDatepicker").datepicker({
        showOn: "button",
        buttonImage: "/assets/img/calendar.gif",
        buttonImageOnly: true,
        minDate: 0,
        required: true,
        message: "This is a required field",
        dateFormat: 'dd-mm-yy',
        onClose: function() {$(this).valid();}
    });
});

$(function () {
    $("#validAfterDatepicker").datepicker({
        showOn: "button",
        buttonImage: "/assets/img/calendar.gif",
        buttonImageOnly: true,
        minDate: +1,
        required: true,
        message: "This is a required field",
        dateFormat: 'dd-mm-yy',
        onClose: function() {$(this).valid();}
    });
});

Ive set required to true so shouldn’t it throw a validation error if you miss it?

The site where the form is: http://www.rentruck.co.uk

I’ve also had a look at this but cant seem to replicate it http://keith-wood.name/uiDatepickerValidation.html

  • 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-15T17:10:21+00:00Added an answer on June 15, 2026 at 5:10 pm

    You could try these two validation libraries for validating the jQuery UI Datepicker.

    Working Example for H5F

    CSS:

    .valid {
      background: green;
      color: #fff;
    }
    .error {
      background: red;
      color: #fff;
    }
    ​
    

    HTML:

    <form id="h5ftest">
        <input type="date" required pattern="\d{2}\/\d{2}\/\d{4}">
    </form>​
    

    jQuery:

    $(function() {
      H5F.setup( $( "#h5ftest" ) );
    
      $( "[type=date]" ).datepicker({
        onClose: function() {
          $( this ).focus().blur();
        }
      });
    });​
    

    or Working Example for jQuery Validate plugin

    CSS:

    .valid {
      background: green;
      color: #fff;
    }
    .error {
      background: red;
      color: #fff;
    }​
    ​
    

    HTML:

    <form id="jQueryValidateTest">
        <input type="date" required>
    </form>​
    

    jQuery:

    $(function() {
    
      $( "#jQueryValidateTest" ).validate();
    
      $( "[type=date]" ).datepicker({
        onClose: function() {
          $( this ).valid();
        }
      });
    });​
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to validate two date attributes in order that they be consecutive. The
I am trying to validate User Input in Windows Forms Application (using MVP design
I'm trying to validate user input data using jquery. Here is the code I
I am trying to validate one input. So I wanna to get this kind
I am trying to validate two checkboxes. One of them must be checked in
I am trying to validate two fields. One is open time and the other
When trying to validate my site, I get the following error: Line 188, column
While trying to validate my forms i get the following error: Expected a {
While trying to validate form data on my page i get the following error:
i am trying to validate a user registration form in Zend Framework 2. More

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.