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!

Request.Form adds comma to form value in FireFox

Status
Not open for further replies.

lasers

Technical User
Oct 24, 2007
12
I have an html form on an asp page and when the form is submitted, I collect the values from the form in ASP using Request.Form("fieldName"). All of the form values are collected properly in IE, but in FireFox the values all have commas after them. Why would this be?

I have confirmed the following:
1. Each form element is named uniquely on the page (the most common reason for the comma is duplicated form element names).

2. It happens in FireFox only.

any ideas why this might be happening?
 
What happens if the field is empty? Do you get a comma?

Is there maybe some kind of JavaScript function that is triggered by the form's [tt]onSubmit[/tt] event where maybe the comma is getting injected like that?
 
Never heard of this, can you post your code (at least the relevant bits)?

Nick

where would we be without rhetorical questions...
 
Sheco: yes, I get the comma if the field is empty.
as a test I moved some form elements outside of an absolutely positioned div, and the comma went away when the form was submitted.

Now the thing with this div, is that when the page loads it has it's visibility property set to "hidden". Then there is a button that the user clicks and this button uses javascript to change the innerHTML property of another div to the innerHTML of the hidden div. This has the effect of creating 2 form fields with the same name.

For some reason, this affects firefox and not IE.

Now I have to find a way to create the same effect, but not using the innerHTML of another div
 
What if you use the ASP to write the hidden HTML into a variable in the client-side JavaScript.... something like this:
Code:
<%
Dim strHTML
strHTML = "Please enter Foo: <input type='text' name='foo'>"
%>

<script>
  var sHidden = "<%= strHTML%>";
</script>

In this way you are using server-side ASP to supply a value for a client-side script variable. Then you can use this script variable to supply the innerHTML for your div.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top