Hi, I was wonder if any JavaScript pros could point me in the right direction here.
I don't know much about scripting yet but I'm trying to find 2 small validation programs, or figure out how to write them myself.
For one, I need a text box where you would type your age, and have a submit and reset button. Then have JavaScript code that would basically validate whether or not you entered a number and have a pop up window stating whether or not you did.
And for another, I need to validate whether or not a user typed in the date in the correct format.
(meaning 12/8/2009 or 12-8-2009. it can have either of those 2 symbols.)
And again, have a pop up window stating whether or not you did.
I know how to make the buttons, I just know nothing about JavaScript. I'm not asking anyone to just write the program for me but if you could either explain a little bit about what a program like that consists of or if you know a good tutorial, I'd be forever grateful.
And for another, I need to validate whether or not a user typed in the date in the correct format.
(meaning 12/8/2009 or 12-8-2009. it can have either of those 2 symbols.)
How could you know whether the user, when entering 12/8/2009, had in mind the 12th of August or the 8th of December? Both are valid dates, aren't they? Never relay on the user's good will (nor suppose the user is always an American, or always an European) and don't let him the possibility to make mistakes. Use 3 separate inputs (or select elements), one for the Date, one for the Month and one for the Year.
Oh wow I didn't expect anyone to just give code for it. Thank you I'll give it a shot.
And to Kor, you're right I just meant that it needed to have either the / or - symbols in the date for JavaScript to see it as valid. But that is a good point to remember.
Bookmarks