www.webdeveloper.com
Results 1 to 2 of 2

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

  1. #1
    Join Date
    Apr 2013
    Posts
    2

    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
    Location
    Ankh-Morpork
    Posts
    19,176
    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.
    "Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
    ~ Terry Pratchett in Nation

    eBookworm.us

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



Recent Articles