/    Sign up×
Community /Pin to ProfileBookmark

Spliting text box

Hi all,

I have a requirement where user enters time in the format HH:MM in a text Box. I have a validator written and if user enters anything other than this format I throw a validation edit. Everything looks good until here.

Now, User dont want to enter the colon “:”, and he wants to tab between HH and MM. Stated another way, when user types HH cursor should go to MM and the colon should be in fixed/frozen position.

I first thought of having a two textBoxes so user can enter the HH and MM in different textboxes and use javaScript to concatenate it and send it to back end.

Second, I thought may be I will use javaScript and on keyDown or Key up change event call a function when does this functionality.

I definitely don’t want to use first approach because I am using this time textbox in a dataTable and I don’t to have an two columns for each value.

Any suggestions please?

to post a comment
JavaScript

1 Comments(s)

Copy linkTweet thisAlerts:
@SparoHawkJun 11.2010 — Just use two separate boxes and join them with your server side code before inserting it to the database.
×

Success!

Help @niki007 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 6.17,
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: @nearjob,
tipped: article
amount: 1000 SATS,

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

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...