Results 1 to 4 of 4

Thread: Passing Variables with POST Method

  1. #1

    Thread Starter
    Giants World Champs!!!! Mark Gambo's Avatar
    Join Date
    Sep 2003
    Location
    Colorado
    Posts
    2,965

    Passing Variables with POST Method

    I have a two ASP forms. The fist one has a table which is loaded with data from a sql db. Currently I am using the Get method of passing data from the first form to the second. Now I want to use the Post Method of passing variables between the two forms.

    This is my problem the only way I can get this to work is to create a button adjacent to each row in the table and assign the search value as it's name:

    VB Code:
    1. <tr>
    2.         <td><% =LngCounter %>.</td>
    3.         <td><%= mid(rstSimple.Fields("Incident_Type").Value,4)%> &nbsp</td>
    4.         <td Align = "Center"><%= rstSimple.Fields("Filenum").Value%> &nbsp</td>
    5.         <td Align = "Center"><%= rstSimple.Fields("CASENUM").Value%> &nbsp</td>
    6.         <td Align = "Center"><%= rstSimple.Fields("Received_Dt").Value%> &nbsp</td>
    7.         <td Align = "Center"><%= rstSimple.Fields("STATUS").Value%> &nbsp</td>
    8.         <td Align = "Center">Not in Mailbox</td>
    9.         <td><input type="submit" Name = "INCNUM" value= <% =IncNumber %>></td>
    10.            </tr>

    INCNUM is the value that I have to pass to the other form in order to access the related data on the second form. I guess I need to add a hidden text box to my form and them some how transfer the value of the selected row's INCNUM to the other form. But I am stumped, any ideas?



    Thanks
    Regards,

    Mark

    Please remember to rate posts! Rate any post you find helpful. Use the link to the left - "Rate this Post". Please use [highlight='vb'] your code goes in here [/highlight] tags when posting code. When a question you asked has been resolved, please go to the top of the original post and click "Thread Tools" then select "Mark Thread Resolved."


  2. #2
    Big D Danial's Avatar
    Join Date
    Jul 2000
    Location
    ASP.Net Forum
    Posts
    2,877
    Why are you using Post method?

    If you must use Post method, then create a form and have a hidden input field, e.g <input type=hidden name=incnum>

    Now use your input button to calll a Javascript function (which will take the INCNUM as parameter), now use javascript to fill the hidden input field and then submit the form.

    <input type="submit" Name = "button1" value="JavaScript:Go(<% =IncNumber %>)">

    Have a javascript function like :

    function Go(Id)
    {

    document.form1.incnum.value=id;
    document.form.submit();
    }


    That should do it.
    [VBF RSS Feed]

    There is a great war coming. Are you sure you are on the right side? Atleast I have chosen a side.

    If I have been helpful, Please Rate my Post. Thanks.

    This post was powered by :

  3. #3

    Thread Starter
    Giants World Champs!!!! Mark Gambo's Avatar
    Join Date
    Sep 2003
    Location
    Colorado
    Posts
    2,965
    Danial

    Thanks for the quick post.

    Where should I one hidden text box for every row in the table (<input type=hidden name=incnum>? )?

    What will appear on the Button Face when I use this method (<input type="submit" Name = "button1" value="JavaScript:Go(<% =IncNumber %> )">)

    Have a javascript function like :

    function Go(Id)
    {

    document.form1.incnum.value=id;
    document.form.submit();
    }


    That should do it.
    Regards,

    Mark

    Please remember to rate posts! Rate any post you find helpful. Use the link to the left - "Rate this Post". Please use [highlight='vb'] your code goes in here [/highlight] tags when posting code. When a question you asked has been resolved, please go to the top of the original post and click "Thread Tools" then select "Mark Thread Resolved."


  4. #4
    Big D Danial's Avatar
    Join Date
    Jul 2000
    Location
    ASP.Net Forum
    Posts
    2,877
    Originally posted by Mark Gambo
    Danial

    Thanks for the quick post.

    Where should I one hidden text box for every row in the table (<input type=hidden name=incnum>? )?

    What will appear on the Button Face when I use this method (<input type="submit" Name = "button1" value="JavaScript:Go(<% =IncNumber %> )">)

    Have a javascript function like :

    function Go(Id)
    {

    document.form1.incnum.value=id;
    document.form.submit();
    }


    That should do it.
    Sorry there was a mistake. It should have been OnClick instead of Value=...

    Here is ........

    Code:
    <head>
    <script>
    function Go(id)
    {
    	document.form1.incnum.value=id;
    	document.form1.submit();
    }
    </script>
    </head>
    <html>
    <body>
    <form name=form1 method=post action="yourTargetFile.asp">
    <input type=hidden name=incnum>
    <input type=button value="<%=incnum%>" onclick="JavaScript:Go(<%=incnum%>)">
    </body>
    </html>
    [VBF RSS Feed]

    There is a great war coming. Are you sure you are on the right side? Atleast I have chosen a side.

    If I have been helpful, Please Rate my Post. Thanks.

    This post was powered by :

Posting Permissions

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



Click Here to Expand Forum to Full Width