471,571 Members | 1,045 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,571 software developers and data experts.

Problem passing selected value to another page

6
Hello,

The requirement is to display rows of data on a classic ASP page for rows in a recordset. On each row we have a link at the end to show detailed information about the selected row. A snapshot of the code is as follows: Please do not mind the html tags.

Expand|Select|Wrap|Line Numbers
  1. <table>
  2.     <th>Ticket number</th>
  3.     <th>Opened on</th>            
  4.                  <th>Priority</th>
  5.      <th>Description</th>
  6.      <th>&nbsp;</th>
  7. <%
  8.     Set rs = rs.NextRecordSet()
  9.  
  10.     do while not rs.EOF
  11.  
  12. %>    
  13.  
  14. <tr><td nowrap>
  15. <b>
  16. <%=rs("CallID")%>
  17. </b></td>
  18. <td><%=rs("DateEntered")%></td>  
  19. <td align="center" nowrap><%=rs("PriorityID")%></td>
  20. <td width="50%"><%=rs("Subject")%></td>
  21. <td valign="bottom" nowrap><a href="viewticket.asp?callid=<%=rs("CallID")%>">View detail <img border=0 src="/support/images/right.gif"></a></td>
  22. </tr>
  23. <%
  24.    rs.MoveNext
  25.    Loop
  26. %>
  27. </table>
  28.  
The above code displays the call id in the URL but the requirement is not display the callid in the URL - possibly by using hidden fields for each row. I am unable to pass the selected value (in this case a callid) to another ASP page.

Any advise help will be appreciated.

Thanks,
jmash
Oct 1 '07 #1
3 4179
jhardman
3,406 Expert 2GB
jmash,

if I wanted to use a hidden input I would do something like this:
Expand|Select|Wrap|Line Numbers
  1. <form name="form1" action="viewticket.asp" method="post"><input type="hidden" name="callid"></form>
  2. ...
  3. <a onClick="document.all.form1.callid.value='<%=rs("callid")%>'; document.all.form1.submit()">View detail <img border=0 src="/support/images/right.gif"></a>
  4.  
There are probably easier ways to do this, but you are entering javascript territory and I am not welcome there.

Jared
Oct 2 '07 #2
jmash
6
Hi Jared,

Thanks for your comments. I have simplified the code to the following:

Expand|Select|Wrap|Line Numbers
  1. PassValue.asp
  2. <%@ language="VBScript"%>
  3. <html>
  4. <HEAD>
  5. <script language="javascript">
  6. <!--
  7. function setval(id)
  8. {
  9.     alert("Testing");    
  10.     document.all('selectedvalue').value=id;
  11.     alert(document.all('selectedvalue').value);
  12.     return false;
  13. }
  14. //-->
  15. </script>
  16. </HEAD>
  17.  
  18. <body>
  19. <form action="TestSession.asp" method="post" name="ViewDetail" ID="ViewDetail">
  20.     <!--<a href="TestSession.asp" onclick="<%session("callid")="100"%>">Test</a>-->
  21.     <input type="hidden" name="selectedvalue" id="selectedvalue" value="">
  22.     <a href="TestSession.asp" onclick="setval(100);ViewDetail.submit()">Test</a>
  23. </form>
  24. </body>
  25. </html>
  26.  
The above code works fine.

Now I want to check the value of hidden field selectedvalue within another page:

[code]
TestSession.asp
<%@ Language="VBScript" %>
<html>
<head>
</head>
<body>
<form action="listopentickets.asp" method="post" name="formviewdetail" ID="formviewdetail">
Test ticketid
<br>
<%=Request.Form.Item("selectedvalue")%>
</form>
</body>
</html>

But the above code does not display the hidden field value. Any ideas? Sorry it looks so simple but still it does not work.

Many thanks in advance,
jmash

jmash,

if I wanted to use a hidden input I would do something like this:
Expand|Select|Wrap|Line Numbers
  1. <form name="form1" action="viewticket.asp" method="post"><input type="hidden" name="callid"></form>
  2. ...
  3. <a onClick="document.all.form1.callid.value='<%=rs("callid")%>'; document.all.form1.submit()">View detail <img border=0 src="/support/images/right.gif"></a>
  4.  
There are probably easier ways to do this, but you are entering javascript territory and I am not welcome there.

Jared
Oct 3 '07 #3
jhardman
3,406 Expert 2GB
jmash,

try:
Expand|Select|Wrap|Line Numbers
  1. <%=Request("selectedvalue")%>
Sometimes I list everything sent with the following code, just to make sure my stuff was sent and received by the next page:
Expand|Select|Wrap|Line Numbers
  1. dim x
  2. response.write "<b>Form inputs:</b><br>"
  3. for each x in request.form
  4.    response.write x & ": " & request.form(x) & "<br>" & vbNewLine
  5. next
  6.  
  7. response.write "<b>Querystring inputs:</b><br>"
  8. for each x in request.querystring
  9.    response.write x & ": " & request.querystring(x) & "<br>" & vbNewLine
  10. next
  11.  
  12. response.write "<b>Cookies:</b><br>"
  13. for each x in request.cookies
  14.    response.write x & ": " & request.cookies(x) & "<br>" & vbNewLine
  15. next
  16.  
  17. response.write "<b>Server Variables:</b><br>"
  18. for each x in request.serverVariables
  19.    response.write x & ": " & request.serverVariables(x) & "<br>" & vbNewLine
  20. next
Of course you probably would know if you had sent a cookie, so that part is probably not very useful. The server variables have some useful info, but probably not for your current project. But I think it's a good idea to print out the form and querystring inputs like this for troubleshooting.

Jared
Oct 3 '07 #4

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

6 posts views Thread by Shaun Fleming | last post: by
2 posts views Thread by Mike Collins | last post: by
2 posts views Thread by sorobor | last post: by
reply views Thread by XIAOLAOHU | last post: by
reply views Thread by leo001 | last post: by
reply views Thread by lumer26 | last post: by
reply views Thread by Vinnie | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.