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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

text input boxes show comma values

Status
Not open for further replies.

stupy1

Programmer
Feb 22, 2002
10
US
hi all,

I have a column of text boxes in an html table that all "should" have value="" unless a value was placed in by a user, but when I cycle through the request form and print to screen some (not all) text boxes return one, two or three commas as their value when no value was entered. The code:

---create the table with below----row that repeats from loop---
<tr>
<td><input type=&quot;text&quot; name=Quantity.<%=rs(&quot;src&quot;)%> style=&quot;WIDTH: 28px;&quot;></td></tr>

---returns a nice html table like below---sample output 2 rows----
<tr><td><input type=&quot;text&quot; name=Quantity.01040A000 style=&quot;WIDTH: 28px;&quot;></td></tr>
<tr><td><input type=&quot;text&quot; name=Quantity.01042A000 style=&quot;WIDTH: 28px;&quot;></td></tr>

----loop to print to screen----
<%
for each item in Request.Form 'loop through request object
if left(item,8) = &quot;Quantity&quot; and not Request.Form(item) = &quot;&quot; then

response.write(&quot;<font size=3>&quot; & item & &quot; &quot; & Request.Form(item) & &quot;<br>&quot;)

end if

next
%>

the output to the screen when I entered a quantity of 5 into text box Quantity.01040A000, but nothing into text box Quantity.01042A000 is below. Could this be a IIS bug? Don't know.

Quantity.01040A000 5
Quantity.01042A000 , , ,

Somehow these commas are getting placed in as a value and bypassing my if statement. This is crazy!!

thanks,

Justin
 
I don't understand why you are making this more complicated then it should be?! What are you trying to accomplish with these long names for your check boxes...
 
I think you have multiple form-fields by the same name.
Also you should trim the values before checkinig, like this:

Code:
if left(item,8) = &quot;Quantity&quot; and not TRIM(Request.Form(item)) = &quot;&quot; then
This is not a bug - it's an undocumented feature...
;-)
 
As Jonax says, the problem is that you have more than one text field with the same name. The commas are separating the values in each text field when you print them out. It just so happens that the text fields don't contain any values and that is why you are only seeing commas. Mighty :)
 
Mighty,

I bow to your greatness. That was it. The query was returning duplicate values thus making duplicate text box names. Learn something new everyday. Thank you my programming brothers for your quick responses.

stupy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top