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.
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.
> 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.
> 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.
>On Jul 10, 11:26 am, Warren Michelsen <wmichel...@mac.com> wrote: >> 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.
>> 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.
>-- >You received this message because you are subscribed to the Google >Groups "Web Authoring" group. >To post to this group, send email to web-authoring@googlegroups.com. >To unsubscribe from this group, send email to >web-authoring+unsubscribe@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