View Full Version : submit text to textfield button

05-10-2006, 06:16 AM
I would like to submit a pre detrmined line of text to a text field with a button.

example here: http://www.silversupplies.com/catalog/tools/burnisher/burnishers.shtml
you can see where it says "item# 79-10-001 Curved Burnisher 1 1/2" $6.35"

I want to paste that info into the text field on top insted of making the customer have to copy and paste to there by hand, but to make it more difficult I need the customer to be able to add several different tools or whatever without deleting the old entry in the same textfield .... I realize that the method sucks altogether but I do what my boss lets me do. Believe it or not its better than it used to be. ugg I know..how bad it is, so thanks for not telling how bad it is....I know..:)

so I am fairly new to this, and will appreceate any assistance greatly..
Thanks in advance,

05-10-2006, 07:28 AM
hi, this is one of the methods you could do it. However, I'am sure is the correct or fit you needs.
let me know if not. :)

use server script build a list of index. and then create a clientscript to copy & paste the items you want.
this is a sample code, but there are many way to do the same things

Hope this help

<script language="javascript" type="text/javascript">
// create an array to hold the items users have selected & pasted in shoping Cart
var ShopCart = [];

function addItem(itemid)
// get the textarea and each items reference and copy & paste it
var p = document.getElementById("producttoadd");
p.value += ( document.getElementById("item_" + itemid).innerHTML + "\n" );
ShopCart.push(document.getElementById("item_" + itemid).innerHTML);
// -->
<textarea id="producttoadd" cols="60" rows="8"></textarea>
<br />
<span id="item_1">item# 79-10-001 Curved Burnisher 1 1/2" $6.35></span>
<a href="javascript:addItem(1)">Add Item</a><br />
<span id="item_2">item# 79-10-001 Curved Burnisher 7 1/2" $6.35></span>
<a href="javascript:addItem(2)">Add Item</a><br />
<span id="item_3">item# 79-10-001 Curved Burnisher 10 1/2" $6.35></span>
<a href="javascript:addItem(3)">Add Item</a><br />
<br />


05-10-2006, 08:42 PM
Cool Thanks I'll play with it and see what i can do. I really appreciate the help! Oh one more thing is there a way to make the add item link a button?
i'll keep you updated..