PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197

PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197

PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197

PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197

PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197
**Resolved** Button, Hidden Textbox and Post Method-VBForums
Results 1 to 9 of 9

Thread: **Resolved** Button, Hidden Textbox and Post Method

  1. #1

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

    **Resolved** Button, Hidden Textbox and Post Method

    How can I transfer data from a hidden text box to another page via the post method. Here is my code:

    Page1.asp

    VB Code:
    1. <html>
    2. <head>
    3. <title>Page1.asp</title>
    4. <h1>Page1.asp</h1>
    5. </head>
    6.  
    7. <body>
    8.  
    9. <table>
    10. <form action = "Page2.asp" Method = "Post">
    11.  
    12. <tr>
    13. <td>Mark</td>
    14. <td><Input type = "Submit" Name "LookupBut" Value = "Request Info"</td>
    15. <td><Input type = "hidden" Name "Lookup" Value = "Mark"</td>
    16. </tr>
    17.  
    18. <tr>
    19. <td>Joe</td>
    20. <td><Input type = "Submit" Name "LookupBut" Value = "Request Info"</td>
    21. <td><Input type = "hidden" Name "Lookup" Value = "Joe"</td>
    22. </tr>
    23.  
    24. <tr>
    25. <td>Peter</td>
    26. <td><Input type = "Submit" Name "LookupBut" Value = "Request Info"</td>
    27. <td><Input type = "hidden" Name "Lookup" Value = "Peter"</td>
    28. </tr>
    29.  
    30. </form>
    31. </table>
    32. </body>
    33. </html>

    Page2.asp

    VB Code:
    1. <html>
    2. <head>
    3. <title>Page2.asp</title>
    4. <h1>Page2.asp</h1>
    5. </head>
    6. <body>
    7.  
    8. <%
    9. strName = Request.Form("Lookup")
    10. %>
    11. You selected <%= strName %> 's Name
    12.  
    13. </body>
    14. </html>

    When I click on the button adjecent to Peter's Name I want to transfer the value of the hidden textbox to Page2.asp.

    I have searched the forum and I couldn't figure out how to accomplish this. Any ideas


    Thanks,
    Last edited by Mark Gambo; Sep 8th, 2004 at 01:40 PM.
    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
    [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

    You did but....

    I am not able to get your code to work. Here is what I have tried so far:

    Page1.asp

    VB Code:
    1. <HEAD>
    2. <title>Untitled Document</title>
    3. <script>
    4. function Go(id)
    5. {
    6.     document.Page1.incnum.value=id;
    7.     document.Page1.submit();
    8. }
    9. </script>
    10. </HEAD>
    11. <HTML>
    12. <body>
    13. <form name=Page1 method="post" action="Page2.asp">
    14. <input type=hidden name="incnum">
    15. <input type = "Button" value="Mark" onclick="java script:Go("Mark")"><br><br>
    16. <input type = "Button" value="Peter" onclick="java script:Go("Peter")"><br><br>
    17. <input type = "Button" value="Harry" onclick="java script:Go("Harry")"><br><br>
    18. </form>
    19. </BODY>
    20. </HTML>

    Page2.asp

    VB Code:
    1. <HTML>
    2. <HEAD>
    3. <title>Untitled Document</title>
    4. </HEAD>
    5. <%
    6. strOffNumber = Request.Form("incnum")
    7. %>
    8. You selected <%= strOffNumber %>'s Name
    9. </BODY>
    10. </HTML>

    I am getting the following Runtime error "Expected ';' " on the following lines:

    VB Code:
    1. <input type = "Button" value="Mark" onclick="java script:Go("Mark")"><br><br>
    2. <input type = "Button" value="Peter" onclick="java script:Go("Peter")"><br><br>
    3. <input type = "Button" value="Harry" onclick="java script:Go("Harry")"><br><br>


    Any suggstions?
    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

    Re: You did but....

    remove the spaces between java and script

    So instead of java script it should be javascript. The forum software messes it up.

    Code:
    <input type = "Button" value="Mark" onclick="javascript:Go("Mark")"><br><br>
    <input type = "Button" value="Peter" onclick="javascript:Go("Peter")"><br><br>
    <input type = "Button" value="Harry" onclick="javascript:Go("Harry")"><br><br>
    [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 :

  5. #5

    Thread Starter
    Giants World Champs!!!! Mark Gambo's Avatar
    Join Date
    Sep 2003
    Location
    Colorado
    Posts
    2,965
    Now I get a syntax error on those lines:

    Code:
    <input type = "Button" value="Mark" onclick="javascript:Go("Mark")"><br><br>
    <input type = "Button" value="Peter" onclick="javascript:Go("Peter")"><br><br>
    <input type = "Button" value="Harry" onclick="javascript:Go("Harry")"><br><br>
    Any ideas??
    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."


  6. #6
    Big D Danial's Avatar
    Join Date
    Jul 2000
    Location
    ASP.Net Forum
    Posts
    2,877
    You cant have doble quote inside double quote

    e.g

    onclick="javascript:Go("Mark")">

    it should be onclick="javascript:Go('Mark')">

    Code:
    <HEAD>
    <title>Untitled Document</title>
    <script>
    function Go(id)
    {
    	document.Page1.incnum.value=id;
    	document.Page1.submit();
    }
    </script>
    </HEAD>
    <HTML>
    <body>
    <form name=Page1 method="post" action="Page2.asp">
    <input type=hidden name="incnum">
    <input type = "Button" value="Mark" onclick="javascript:Go('Mark')"><br><br>
    <input type = "Button" value="Peter" onclick="javascript:Go('Peter')"><br><br>
    <input type = "Button" value="Harry" onclick="javascript:Go('Harry')"><br><br>
    </form>
    </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 :

  7. #7
    Big D Danial's Avatar
    Join Date
    Jul 2000
    Location
    ASP.Net Forum
    Posts
    2,877
    Arghh the forum adds space between java and script, make sure you remove that.
    [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 :

  8. #8

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

    It works!!

    No I figured out my error I was using a double quote instead of a single quote in the onclick event:

    <input type = "Button" value="Mark" onclick="javascript:Go('Mark')"><br><br>

    I works fine now, Thanks once again!!!!!
    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."


  9. #9
    Big D Danial's Avatar
    Join Date
    Jul 2000
    Location
    ASP.Net Forum
    Posts
    2,877

    Re: It works!!

    Originally posted by Mark Gambo
    No I figured out my error I was using a double quote instead of a single quote in the onclick event:

    <input type = "Button" value="Mark" onclick="javascript:Go('Mark')"><br><br>
    Thats what i said in my post!
    [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
  •  



Featured


Click Here to Expand Forum to Full Width