Forum Moderators: open

Message Too Old, No Replies

Formatting Text box

         

Esqulax

2:48 pm on Jan 17, 2008 (gmt 0)

10+ Year Member



hiya,

I'm thinking of making a box to input a Date (that will eventually be written to a SQL Database....

Is it possible to format a text box so that:

a) only numbers are accepted, and also within range(1-31 and 1-12)
b)to make it so that theres permanent slashes displayed (so the user sees a text box with 17/01/2008, but can click on say 17 and change it without affecting the rest.)

Maybe 3 text boxes, and on submit it concatenates the numbers with / or - as a divider.. is that possible?
Also how to make the default value todays date

Thanks

Esqulax

3:04 pm on Jan 17, 2008 (gmt 0)

10+ Year Member



Ok, so ive used PHP to get the current date...
any ideas how i could make the error thing, sos people cant enter 56th of the 14th?
Maybe javascript?

coopster

3:23 pm on Jan 17, 2008 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



You're on the right track. There is a ton of information out there on javascript date/calendar functions. And don't forget to check the date again on the server side after the form has been submitted! Never trust user-supplied data and never count on client-side editing such as JavaScript to "scrub" your input!