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 4 of 4

Thread: Form Values

  1. #1
    New Coder
    Join Date
    Jun 2002
    Posts
    57
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Form Values

    I am currently working on a site which has a special offers page and an ordering page. When you are on the special offers page, you are shown the monthly offer and are given the option to order it.

    On the ordering page, there are several form fields to add in manually, such as Part Number and Description. What I would like to do is when you click on the order link on the special offers page, the two fields Part Number and Description are filled out on the ordering page.

    I have managed to pass the values on to the page using this code........

    <a href="ordering.asp?partno=4696-114-0&desc=Ratcliff Starter Soleniod">click here</a>

    <script type="text/javascript">
    //<![CDATA[
    function parseSearchString()
    {
    var pairs=unescape(location.search.substring(1).replace(/\+/g," ")).split('&');
    for (var i=0;i<pairs.length;i++){
    var pair = pairs[i].split('=');
    this[pair[0]]=pair[1];
    }
    }
    var search = new parseSearchString();

    //this will output all the passed variables
    document.write("These are the variables passed:<br />");
    for (o in search) document.write(o + " = " + search[o]+"<br />");
    //]]>
    </script>

    .....but I have no idea how to make this fill out the form input fields??

    Hope you can help.

    Many thanks

    Chris

  • #2
    Senior Coder
    Join Date
    Aug 2002
    Location
    UK
    Posts
    2,789
    Thanks
    2
    Thanked 14 Times in 14 Posts
    An example here might help you out

    http://www.huntingground.freeserve.c...ta/p_data3.htm

  • #3
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,068
    Thanks
    0
    Thanked 256 Times in 252 Posts
    Since you are using ASP, why not do the parsing in the server-side?

    <%
    partno=Request.QueryString("partno")
    desc=Request.QueryString("desc")
    %>
    ...
    <input type="text" name="partno" value="<%=partno%>">
    <input type="text" name="desc" value="<%=desc%>">

    Is that what you want?
    Glenn
    ____________________________________

    My Blog
    Tower of Hanoi Android app (FREE!)
    Tower of Hanoi Leaderboard
    Samegame Facebook App
    vBulletin Plugins
    ____________________________________

  • #4
    New Coder
    Join Date
    Jun 2002
    Posts
    57
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Perfect Glenn, thanks a lot, you've saved my bacon!


  •  

    Posting Permissions

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