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!

Data returned from Form entry has commas after?

Status
Not open for further replies.

vlree

IS-IT--Management
Jan 16, 2004
31
0
0
US
I am new to ASP.
I have 3 very simple forms for a user to sign up for a meeting. Form one collects some data choices and passes that info to form two, where it is displayed at the top of the page while the user fills out name, address etc on form two.

Form two is very simple text boxes to collect name etc
Example:
<input name="atnFirstName" type="text" size="60" maxlength="150" />&nbsp;</input>

However, when FirstName is passed to page three, I get the FirstName plus a comma.
Example:
Victoria Ree,

I am confused, I am passing info from Form One to Page two and all works well, but from Form Two to Page three I get the comma. Does anyone know why?
 
Do you have another INPUT box on the page with the same name (atnFirstName). If you do then the FORM collection will contain both entries separated with a comma.

Also, the &nbsp;</input> is not necessary in your above example.


Tony
________________________________________________________________________________
 
No I dont, I did some reading on the form colletion and got that information, but on page three it is only to display info collected on the 2 previous pages, and firstName occurs only once on page two.
 
PS I have this at the top of my page:
<%
prvFirstName = (Request.Form("atnFirstName"))
%>

and this to display it:
<% Response.Write prvFirstName %>
 
<% Response.Write prvFirstName %> displays a ,? then like Tony said it must be a name problem...

Known is handfull, Unknown is worldfull
 
Ok Gentlemen You are correct. I changed the atnFirstName to Bob and it works with no problem. Can you explain why? There is still only ONE FirstName field, whether is it named Bob or atnFirstName any clue?
 
Ok Will do, however let me tell you this: I prefixed the FirstName field with "atn" to mean attendee, because I will also at some point have spouse FirstName and child FirstName, so I was trying to create a description for my use. That being said, I changed the "atn" to "txt" and it works fine also?
I have never posted to code to tek tips before, after I do some reading on how to do that I sure will.
Thank you.
 
Ok here it the top of the form:
</head>
<%
CompName1 = (Request.Form("Competitor1"))
CompName2 = (Request.Form("Competitor2"))
CompName3 = (Request.Form("Competitor3"))
BoothCh1 = (Request.Form("BoothChoiceSng1"))
BoothCh2 = (Request.Form("BoothChoiceSng2"))
BoothCh3 = (Request.Form("BoothChoiceSng3"))
%>

<body>
<!-- Attendee form to put contact info into attendee table in db; -->
<form name="frmAttendeeInfo" method="post" id="002">
<table width="500" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td class="main1" colspan="3">Single Booth Registration cont'd</td>
</tr>
<tr>
<td class="main1" colspan="3">Competitiors Names Entered</td>
</tr>
<tr><td class="userinfo"><% Response.Write CompName1 %></td>
<td class="userinfo"><% Response.Write CompName2 %></td>
<td class="userinfo"><% Response.Write CompName3 %></td>
</tr>
<tr>
<td class="main1" colspan="3">Booth Choices Entered</td>
</tr>
<tr>
<td class="userinfo"><% Response.Write BoothCh1 %></td>
<td class="userinfo"><% Response.Write BoothCh2 %></td>
<td class="userinfo"><% Response.Write BoothCh3 %></td>
</tr>
</table>
<table width="500" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td class="main1" colspan="2">With the purchase of a Booth Registration there is no additional charge
for you to attend, we do still need your information. Thank You.</td>
</tr>
<tr>
<td class="label" width="20%"><label for="FirstName" accesskey="F"><u>F</u>irst Name</label>
</td>
<td class="main" width="80%"><input name="atnFirstName" type="text" size="60" maxlength="150" />&nbsp;</input>
</td>
</tr>
<tr>
<td class="label" width="20%"><label for="LastName" accesskey="L"><u>L</u>ast Name</label></td>
<td class="main" width="80%"><input name="atnLastName" type="text" size="60" maxlength="150" />&nbsp;</input></td>
</tr>

continue thru city state zip phone fax and email....blah blah blah


CONT
HERE IS THE BOTTOM OF THE FORM
<td class="main1" colspan="2">
<input type="hidden" name="CompName1" value="<%=CompName1%>">
<input type="hidden" name="CompName2" value="<%=CompName2%>">
<input type="hidden" name="CompName3" value="<%=CompName3%>">
<input type="hidden" name="BoothCh1" value="<%=BoothCh1%>">
<input type="hidden" name="BoothCh2" value="<%=BoothCh2%>">
<input type="hidden" name="BoothCh3" value="<%=BoothCh3%>">
<input type="hidden" name="atnFirstName" value="<%=atnFirstName%>">
<input type="hidden" name="atnLastName" value="<%=atnLastName%>">
<input type="hidden" name="atnCompanyName" value="<%=atnCompanyName%>">
<input type="hidden" name="atnAddress" value="<%=atnAddress%>">
<input name="Submit" type="submit" value="Add Spouse/Guest ->"><input name="Submit" type="submit" value="Add Minors/Children ->"></td>
</tr></table>
<div align="right">

<INPUT Type=Submit Value="Checkout Preview"
onClick="this.form.action='preview_checkout.asp';"></input></div>

</form>
</body>
</html>

WHICH SUBMITS TO CHECKOUT PREVIEW PAGE

</head>
<%
prvCompName1 = (Request.Form("CompName1"))
prvCompName2 = (Request.Form("CompName2"))
prvCompName3 = (Request.Form("CompName3"))
prvBoothCh1 = (Request.Form("BoothCh1"))
prvBoothCh2 = (Request.Form("BoothCh2"))
prvBoothCh3 = (Request.Form("BoothCh3"))
prvFirstName = (Request.Form("txtFirstName"))
prvLastName = (Request.Form("atnLastName"))
prvCompanyName = (Request.Form("atnCompanyName"))
prvAddress = (Request.Form("atnAddress"))

%>
<body>
<table border="1" align="center" width="500">
<tr>
<td class="main1" colspan="3">NYSTA 2005 Annual Conference &amp; Expo<br />Conference Attendance Summary</td>
</tr>
<tr>
<td class="main1" colspan="3">Booth Representative Information</td>
</tr>
<tr>
<td class="userinfo"><% Response.Write prvFirstName%></td>
<td class="userinfo"><% Response.Write prvLastName %></td>
<td>&nbsp;</td>
</tr>
<tr>
<td class="main">Your Booth Choices:</td>
<td class="userinfo"><% Response.Write prvBoothCh1 %> or</td>
<td class="userinfo"><% Response.Write prvBoothCh2 %> or</td>
<td class="userinfo"><% Response.Write prvBoothCh3 %></td>
</tr>
<tr>
<td class="main1" colspan="3">Address Information:</td>
</tr>
<tr>
<td class="userinfo" colspan="3"><% Response.Write prvCompanyName %><br /><% Response.Write prvAddress %><br /></td>
</tr>
</table>
</body>
</html>
 
here is your problem. You have a hidden field with the same name as your text field. This will mean that both the text box value and the hidden value will be passed via the form collection separated by a comma.

Code:
<input name="atnFirstName" type="text" size="60" maxlength="150" />

...

<input type="hidden" name="atnFirstName" value="<%=atnFirstName%>">

Tony
________________________________________________________________________________
 
Thank YOU, I know I know, you must be picking yourself up off the floor laughing at us newbies! Thanks anyway! I appreciate it.
 
You learn more by making errors like that then by having never made one. I guarantee most of us only know the answer to that particular answer because we have made (or watched others make) that same exact error. Trust me, the majority of what I know is because I screwed up at some point in the past, or tried to learn from others when they screwed up. A perfect programmer is someone who copied their one and only "Hello World" program from a book, and then never touched the computer again :)

-T

barcode_1.gif
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top