• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

comparing dates

 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have 2 dates A, B.

I get date A displayed on the form and on which I have to enter date B. The condition here is date B should be always later than date A. If user enters prior date in date B Text box and submits, an alert message have to be prompted to correct it. I want to use javascript logic for this.

code snippets please.

Akshaj
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


the form


Eric
 
akshaj nampelly
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I dont want to put with <form tag>. But with submit button I want to validate the two dates.

date A property is already displayed on page. date B will be entered and validated to be prior to date A. date A and B are two properties in a single form.

suggest on this.

Akshaj
 
Eric Pascarello
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
putting the onsubmit handler causes the validatin to occur when the submit button is pressed.

I gave you the basic example for the code. If the date A is hard-coded to the page, then hard-code it into the JavaScript function.

Eric
 
Do you pee on your compost? Does this tiny ad?
Clean our rivers and oceans from home
https://www.kickstarter.com/projects/paulwheaton/willow-feeders
reply
    Bookmark Topic Watch Topic
  • New Topic