Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Sep 10, 2009 01:26 AM by Pikesville Paesano
Jun 08, 2009 10:11 AM|LINK
Not sure whether to ask this in the MVC or te AJAX forum, but here goes. Following Stephen Walther's great blog entries (Tip #36 and #37) on how to use the Script Versions of the Ajax toolkit with MVC I have managed to get the masked edit extender working
in the same way. My problem is I am not sure how best to use it to give me the result I need.
Basically I am trying to create a simple time recording system and I have created a simple MVC application to do this. The idea is time is entered in the format 99:99 i.e. hours and minutes worked. The data itelf will be stored in an integer (total minutes
in effect). I can set a mask to be 99-99 and when the user clicks in the field the - is displayed. The 2 problems I have are I want this formating to to remain after the user leaves the field, at the moment the - disappears. And secondly how can I ensure
that the time entered is valied, for example the first digit cannot be more than 2; if the first digit is 2 then the second digit cannot be more than 4; and the third digit cannot be more than 5.
Is there a good way to use the masked edit control in MVC to do this, or am I going about this all the wrong way; maybe I need to use regular expressions for this. Or maybe I should use to fields one for the hours and one for the minutes and combine them?
Apologies if this is a really obvious thing, I am still very much a noob with all this stuff.
Sep 10, 2009 01:26 AM|LINK
Never shoot a cannon at a rabbit.
Never use AJAX when you can use JQuery.
You''ll pick it up very fast
and odds are there's a plug in already: http://digitalbush.com/projects/masked-input-plugin/