473,395 Members | 1,692 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 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 4338
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

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

Similar topics

12
by: Kevin Lyons | last post by:
Hello, I am trying to get my select options (courses) passed correctly from the following URL: http://www.dslextreme.com/users/kevinlyons/selectBoxes.html I am having difficulty getting the...
1
by: Kevin Lyons | last post by:
Hello, I am trying to get all of my form elements passed correctly from the following URL: http://www.dslextreme.com/users/kevinlyons/selectBoxes.html to the following URL:...
6
by: Shaun Fleming | last post by:
I've been trying to make this simple script compatible across various browsers. It works for IE 6.0 and NS 7 but doesnt work with Opera (I have version 7.11). This is what is supposed to happen:...
2
by: jonefer | last post by:
I'm using a Public variable that I set on one page so that it will be available for another page but, I know this isn't the way it should be done. Being an Access Developer, how would I do the...
2
by: Mike Collins | last post by:
I cannot get the correct drop down list value from a drop down I have on my web form. I get the initial value that was loaded in the list. It was asked by someone else what the autopostback was...
2
by: mrjoka | last post by:
hi guys, i'm building a web site where i have a lot of pages, in the default page i'm having a menu in this menu i have a callendar a drop down list, in the callendar i need to remember the date...
2
satterfieldben
by: satterfieldben | last post by:
I have a newbie question about passing variables between functions. I am wanting to use a drop down box to select a value. Then base on which was selected, it would create a variable and I would...
6
by: jej1216 | last post by:
I am trying to put together a PHP search page in which the user can select none, one, two, or three fields to search, and then the results php will build the SQL with dynamic where caluses to reflect...
2
by: sorobor | last post by:
dear sir .. i am using cakephp freamwork ..By the way i m begener in php and javascript .. My probs r bellow I made a javascript calender ..there is a close button ..when i press close button...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.