Results 1 to 2 of 2

Thread: Need to allow user to input time in hh:mm:ss

  1. #1
    Join Date
    Apr 2013

    Need to allow user to input time in hh:mm:ss

    I am making a download calculator. For calculating the transfer rate the user needs to enter how long the transfer took to finish, e.g. 00:05:13 (5 minutes and 13 seconds). I do not see any appropriate HTML input elements for this. Any suggestions would be appreciated.

  2. #2
    Join Date
    Aug 2004
    I like to use 3 separate <input> fields, each 2 characters long. Separate them with colons on the form page, tweak it with CSS to get the desired look, and you can use JavaScript to automatically move the focus to the next field once the preceding field has 2 characters in it. (I'd probably start by searching JQuery and JQuery plug-ins to see if there's already a function designed for this.)

    This way there's no hassling over whether or not the user entered the correct format with the right delimiters in the proper syntax. You just have to verify that each field has a integer value within its allowed range.
    "Well done....Consciousness to sarcasm in five seconds!" ~ Terry Pratchett, Night Watch

    How to Ask Questions the Smart Way (not affiliated with this site, but well worth reading)

    My Blog
    cwrBlog: simple, no-database PHP blogging framework

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center