/    Sign up×
Community /Pin to ProfileBookmark

Help with Time Field Validation

I have 2 fields; start time and end time.

I want to verify that users enter the time in the correct format for both fields.

By correct format I mean; (HH:MM format). Ex: 12:00
I know a function of some sort can accomplish this, I just cannot figure out how it would be done. I have searched all over and can’t find any examples of this and was wondering if anyone could point me in the right direction?

Here is the code:

[CODE]<html>
<head></head>
<body>

<form name=”myform” method=”post” action=”next.asp”>

<table bgcolor=”#ffffff” border=”0″ width=”250″ cellspacing=”1″ cellpadding=”2″ class=”main”>
<tr>
<td bgcolor=”#FFFFFF”>Start Time:</td>
<td bgcolor=”#FFFFFF”><input type=”text” name=”startTime” maxlength=”5″ size=”5″> (HH:MM format)</td>
</tr>

<tr>
<td bgcolor=”#FFFFFF”>End Time:</td>
<td bgcolor=”#FFFFFF”><input type=”text” name=”endTime” maxlength=”5″ size=”5″> (HH:MM format)</td>
</tr>
</table>

<input type=”Submit” value=”Continue” name=”Continue”>

</body>
</html>[/CODE]

to post a comment
JavaScript

0Be the first to comment 😎

×

Success!

Help @slash75 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.21,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...