Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Request.Form not reporting quite as expected

Status
Not open for further replies.

scribbler

MIS
Feb 4, 2002
206
GB
I have a varying number of chechboxes which when checked and then submitted send their names & values to the next page which displays just the selected items not the whole list of possible options. My problem is that I prefer the options to be in a particular order but at the moment this order for some reason varies and seems to be due to the 10th-11th option being selected... which even with my limited knowledge of asp seems very wierd. Does anyone know of a reason or better still a cure ?

Code:
Dim formvalues(100,2)
Dim checkbox(100,2)
Dim x
Dim i 
For Each x in Request.Form
   i = i + 1 
  checkbox(i,0)=x ' This contains the option description
  checkbox(i,1)=Request.Form(x) ' This contains the actual price of the option selected
response.write checkbox(i,0) & " " checkbox(i,1) & "<br>"
Next
{/code]
 
Unfortunately some browsers do not return the values in a form to your ASP in the same order that they appear on your page.

You can name your form items appropriately and then request them in the order you want.

eg)
Code:
<input type="checkbox" name="check1" value="some" />
<input type="checkbox" name="check2" value="thing" />
<input type="checkbox" name="check3" value="here" />

Code:
<%
For i = 1 To 3
 Response.Write Request.Form("check" & i) & "<br />" & vbcrlf
Next
%>

Tony

Spirax-Sarco - steam traps control valves heat exchangers
Sun Villa - Luxury Florida accommodation
 
Hi Tony

I agee it would be simpler to recognise them if I named them 1,2,3... but my I need the checkbox names (which again vary depending upon the original item chosen, where each item has a varying No. of options and different named options) to be forwarded with the request.form so that I not only know the value but the actual name of the option along with it.
 
For lack of a better solution you could use some client side script to evaluate the selected options prior to submitting and store the results in more predictable hidden field names.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top