Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    May 2006
    Location
    Arizona
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    submit text to textfield button

    I would like to submit a pre detrmined line of text to a text field with a button.

    example here: http://www.silversupplies.com/catalo...rnishers.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,
    DP

  • #2
    New Coder bigtiger's Avatar
    Join Date
    Oct 2005
    Posts
    98
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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
    Code:
    <html>
    <head>
    <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);
    }
    // -->
    </script>
    </head>
    <body>
    <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 />
    
    </body>
    </html>
    Last edited by bigtiger; 05-10-2006 at 07:02 AM.

  • #3
    New to the CF scene
    Join Date
    May 2006
    Location
    Arizona
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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..
    D
    Last edited by kalkisong; 05-10-2006 at 07:49 PM.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •