Forums

ASP

This topic is locked

Autofill forms with button link

Posted 22 Mar 2006 05:11:16
1
has voted
22 Mar 2006 05:11:16 Javier Castro posted:
Hi all,

I have a submit form with 2 fields:

Product Code and Quantity.

I have dynamic table beside my form that displays a catalogue and one of the fields on the table is product code. What I want to do is to make the Product Code on the dynamic table a link that ONCLICK inputs that code to the form. There is something similar in another post but not for a list coming from a DB. Any ideas, samples ? I'm using Classic ASP, DWMX 2004, windows.

Thanks,

Javier

Replies

Replied 22 Mar 2006 16:24:57
22 Mar 2006 16:24:57 Javier Castro replied:
OK. I guess it was too easy and that's why nobody replied to my post. Anyhow, I got the answer I wanted somwhere else and in case someone would need to do something similar, here we go:

<a href="#" onclick="javascript:document.yourFormname.yourselectfieldname.value = 'heregoesyourrecordsetcode';">hello</a>

here is my code to compare what I did:

<a href="#" onclick="javascript:document.form1.prodID.value = '<%=(rsProducts.Fields.Item("product_code".Value)%>';"><%=(rsProducts.Fields.Item("product_code".Value)%></a>

that's it. Cheers,

Javier

Reply to this topic