|
-
Sep 8th, 2004, 11:13 AM
#1
Thread Starter
Giants World Champs!!!!
**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:
<html>
<head>
<title>Page1.asp</title>
<h1>Page1.asp</h1>
</head>
<body>
<table>
<form action = "Page2.asp" Method = "Post">
<tr>
<td>Mark</td>
<td><Input type = "Submit" Name "LookupBut" Value = "Request Info"</td>
<td><Input type = "hidden" Name "Lookup" Value = "Mark"</td>
</tr>
<tr>
<td>Joe</td>
<td><Input type = "Submit" Name "LookupBut" Value = "Request Info"</td>
<td><Input type = "hidden" Name "Lookup" Value = "Joe"</td>
</tr>
<tr>
<td>Peter</td>
<td><Input type = "Submit" Name "LookupBut" Value = "Request Info"</td>
<td><Input type = "hidden" Name "Lookup" Value = "Peter"</td>
</tr>
</form>
</table>
</body>
</html>
Page2.asp
VB Code:
<html>
<head>
<title>Page2.asp</title>
<h1>Page2.asp</h1>
</head>
<body>
<%
strName = Request.Form("Lookup")
%>
You selected <%= strName %> 's Name
</body>
</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."
-
Sep 8th, 2004, 11:31 AM
#2
[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 : 
-
Sep 8th, 2004, 12:28 PM
#3
Thread Starter
Giants World Champs!!!!
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:
<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="java script:Go("Mark")"><br><br>
<input type = "Button" value="Peter" onclick="java script:Go("Peter")"><br><br>
<input type = "Button" value="Harry" onclick="java script:Go("Harry")"><br><br>
</form>
</BODY>
</HTML>
Page2.asp
VB Code:
<HTML>
<HEAD>
<title>Untitled Document</title>
</HEAD>
<%
strOffNumber = Request.Form("incnum")
%>
You selected <%= strOffNumber %>'s Name
</BODY>
</HTML>
I am getting the following Runtime error "Expected ';' " on the following lines:
VB Code:
<input type = "Button" value="Mark" onclick="java script:Go("Mark")"><br><br>
<input type = "Button" value="Peter" onclick="java script:Go("Peter")"><br><br>
<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."
-
Sep 8th, 2004, 12:32 PM
#4
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 : 
-
Sep 8th, 2004, 12:49 PM
#5
Thread Starter
Giants World Champs!!!!
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."
-
Sep 8th, 2004, 12:54 PM
#6
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 : 
-
Sep 8th, 2004, 12:56 PM
#7
-
Sep 8th, 2004, 01:39 PM
#8
Thread Starter
Giants World Champs!!!!
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."
-
Sep 8th, 2004, 01:51 PM
#9
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|