Forums

This topic is locked

Adding date to text box on load

Posted 22 Mar 2002 20:43:17
1
has voted
22 Mar 2002 20:43:17 Mark Drelinger posted:
I would like to set a text box to the current date when a page loads (xx/xx/2002). I can get it to load a lengthy date on blur/click, but can't get the date in the box on load. Any ideas? I'd be willing to buy an extension that did this.

Replies

Replied 23 Mar 2002 01:09:59
23 Mar 2002 01:09:59 Dennis van Galen replied:
<BLOCKQUOTE id=quote><font size=1 face="Verdana, Arial, Helvetica" id=quote>quote:<hr height=1 noshade id=quote>
I would like to set a text box to the current date when a page loads (xx/xx/2002). I can get it to load a lengthy date on blur/click, but can't get the date in the box on load. Any ideas? I'd be willing to buy an extension that did this.
<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>

declare variable current date when page loads in the head of your page, like so:

&lt;% var "varDate" = Date() %&gt;

Then your code for the form element with the date would be changed to:

&lt;input type="text" name="textfield" value="&lt;%= Request("varDate" %&gt;"&gt;

Interesting though, i never knew there was a change text behavior...let alone with a on select function built in, great for things like: onselect change text to "Please fill in your password here..."

With kind regards,

Dennis van Galen
Webmaster KPN Services
Financial and Information Services
Replied 27 Mar 2002 18:58:02
27 Mar 2002 18:58:02 Mark Drelinger replied:
Thanks...someone shared another way also...Type

<b>&lt; %= Date() %&gt;</b> in the <b>Init Val</b> field

Reply to this topic