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

  • Home
  • SEARCH
  • 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 6990981
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T19:25:51+00:00 2026-05-27T19:25:51+00:00

I want to create a very simple javascript form validation. I have two input

  • 0

I want to create a very simple javascript form validation. I have two input boxes that are populated by a datetime picker. the datetime picker populates the input box with in the format 2011-12-21 09:58. I have an input box for collection date and arrival date.

I want to validate that the ‘deliverdatetime’ entered is greater than the ‘collectdatetime’.

The output of a failed validation should just be in a popup window saying ‘deliverdate’ before ‘coolectdate’.

Can this be done with javascript and if so can someone give me a brief example?

my basic html form code is:

...
<td>
<input type="text" id="collectdatetime" name="collectdatetime">
</td>
<td>
<input type="text" id="deliverdatetime" name="deliverdatetime" >
</td>
...

Thanks in advance for the assistance and happy holidays to everyone.

Regards,
Ryan Smith

  • 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-27T19:25:52+00:00Added an answer on May 27, 2026 at 7:25 pm

    GIven the ISO8601 format of the date/time string, you can just compare the values as strings. It’s one of the beauties of using an ISO8601 format. You have asked for the delivery time to be after the collection time, which seems backwards to me but anyhow…

    <form onsubmit="return checkDates(this)">
      <table>
        <tr>
          <td>
            <input type="text" id="collectdatetime" name="collectdatetime">
          <td>
            <input type="text" id="deliverdatetime" name="deliverdatetime">
          <td>
            <input type="submit">
      </table>
    </form>
    
    <script>
    function checkDates(form) {
      if (form.collectdatetime.value >= form.deliverdatetime.value) {
        alert('Collection time must be after deliver time');
        return false;
      }
    }
    </script>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to create a simple http proxy server that does some very basic
I want to create a very simple piece of software in C# .NET that
I have the following issue whith this very simple task. I want to create
I want to create a simple login and registration form, that allows me to
I need to create a very simple application: I need to have a form
I want to create a very simple range picker, but I'm having 3 problems
I want to create a very simple HTML/AJAX based GUI for a Python program.
I have created a very simple sharepoint timer job. All i want it to
I want to create a very simple python web app. I don't need Django
I have a very simple animation task for Java. I need to create a

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.