Forums

ASP

This topic is locked

Clicking link fills out form field. - Possible?

Posted 30 Jan 2007 23:48:30
1
has voted
30 Jan 2007 23:48:30 Tom Scott posted:
Is it possible to have a link enter a form field value?

For example.. I have a form with a "completed date / time" text input.. I want to have a link next to the field with something like "Click for Now" which will input <%=NOW%> into that field without leaving the page.

How can I do this?

THanks a lot.

Replies

Replied 31 Jan 2007 03:03:26
31 Jan 2007 03:03:26 Dan Berdusco replied:
A simple javascript should do the trick:

<pre id=code><font face=courier size=2 id=code>&lt;a href="#" onClick="javascript:document.formName.textBoxName.value = '&lt;%=now()%&gt;';"&gt;Click for Now&lt;/a&gt; </font id=code></pre id=code>
Replied 31 Jan 2007 03:05:22
31 Jan 2007 03:05:22 Dan Berdusco replied:
Another option would be to submit a hidden field with the default value of now()
Replied 31 Jan 2007 15:01:03
31 Jan 2007 15:01:03 Tom Scott replied:
<BLOCKQUOTE id=quote><font size=1 face="Verdana, Arial, Helvetica" id=quote>quote:<hr height=1 noshade id=quote>
A simple javascript should do the trick:

<pre id=code><font face=courier size=2 id=code>&lt;a href="#" onClick="javascript:document.formName.textBoxName.value = '&lt;%=now()%&gt;';"&gt;Click for Now&lt;/a&gt; </font id=code></pre id=code>
<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>

Awesome!!! Thank you very much!

Reply to this topic