JavaScript Form Help

45 views
Skip to first unread message

Warren Michelsen

unread,
Jul 10, 2010, 2:26:01 PM7/10/10
to Web Authoring List
I have a JavaScript that I use with a web form to ensure that users cannot enter non-existent dates into a reservations site, dates like February 30, June 31, etc.

The JS builds the Day selector with the appropriate number of days based on the value of the month selector.

What I'd like to do it modify the value of the Day selected, if the value selected is less than 10, to add a "0" prefix such that the submitted value will always be two digits, even for days before the 10th of a month.

I have a test page at <http://tours.powellmuseum.org/DateSelectTest.html> so you can see the code I use.

It would seem that I can either change the build() function to prefix a zero onto values less than 10 or I can, perhaps, use an onChange function to adjust the Day value after a selection is made. I've tried the latter, unsuccessfully, and the former is probably beyond my understanding and ability where JS is concerned.

All help will be appreciated.

Scout

unread,
Aug 7, 2010, 10:44:49 PM8/7/10
to Web Authoring
Do you want to do that work in javascript, php or mysql?

Mickey

unread,
Aug 8, 2010, 2:07:48 PM8/8/10
to Scout, Web Authoring
At 7:44 PM -0700 8/7/10, Scout sent email regarding Re: JavaScript Form Help:

>Do you want to do that work in javascript, php or mysql?

I fixed it in php. All better now.

>--
>You received this message because you are subscribed to the Google
>Groups "Web Authoring" group.
>To post to this group, send email to web-au...@googlegroups.com.
>To unsubscribe from this group, send email to
>web-authorin...@googlegroups.com.
>For more options, visit this group at
>http://groups.google.com/group/web-authoring?hl=en.


--
Why stand we here idle? What is it that Gentlemen wish? What would
they have? Is life so dear, or peace so sweet, as to be purchased at
the price of chains and slavery! Forbid it, Almighty God! I know not
what course others may take; but as for me, give me liberty or give
me death! -- Patrick Henry, March 1775

Reply all
Reply to author
Forward
0 new messages