Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript Conditional form range limits

  • This topic is empty.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #34020
    Brightonmike
    Member

    How can I do this?

    User enters a date, say 15/08/2011.

    In a second date field, it then does not allow them to enter a date BEFORE the first date.

    #85378
    Dreamdealer
    Member

    You could use the datepicker functions from the jQuery UI library. It has an option that allows the user to pick a start- and an enddate and it allows only to select an enddate that’s after the startdate.

    http://jqueryui.com/demos/datepicker/#date-range

    #85379
    Brightonmike
    Member

    Trouble is, this is for a mobile app, so I’m not sure datepicker would work so well.

    #85381
    Dreamdealer
    Member

    Then you’ll have to search for a snippet (or write one yourself) that checks the difference in entered dates onsubmit. Convert the dates to unix timestamps, subtract the enddate from the startdate and as long as the result is greater than 0, everything is fine.

Viewing 4 posts - 1 through 4 (of 4 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.