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!

Strange behavior - request.form

Status
Not open for further replies.

firsttube

Technical User
Apr 21, 2004
165
CA
I have an asp page with an html form in it. When I execute this code:
Code:
test = request.form("field")
response.write(test)

it writes out the value of the form field "field". However, the strange thing is that there is no form field called "field" !!

Is this possible? or am I crazy?
thanks
ft


Information is not Knowledge, Knowledge is not Wisdom, Wisdom is not Truth, Truth is not Beauty, Beauty is not Love, Love is not Music, Music is the best.
 
Try this:

[tt]
For Each foo In Request
Response.Write foo & " = " & Request(foo) & "<br>"
Next
[/tt]
 
object doesn't support this property or method
on first line


Information is not Knowledge, Knowledge is not Wisdom, Wisdom is not Truth, Truth is not Beauty, Beauty is not Love, Love is not Music, Music is the best.
 
Oh, sorry... for the first line try:[tt]
For Each foo In Request.Form[/tt]
 
The above code shows all the form field names and their values. The strange thing is that the field called "field" shows up. However, in the html form there is no element:
Code:
<input type="hidden" id="field" name="field" value="">

So I have no idea where it is coming from.
There is however, an image in the form that is generated by calling another asp page:
Code:
<img src="image.asp?field=1234">
Could the request.Form method be picking this up as the form element called "field". The reason I ask is that when I display all the objects in Request.Form I get the following:
Code:
field = 1234


Information is not Knowledge, Knowledge is not Wisdom, Wisdom is not Truth, Truth is not Beauty, Beauty is not Love, Love is not Music, Music is the best.
 
Another strange thing is that in FF, the html form field called "field" does not show in the Request.Form object when the page is executed, but it does in IR.

Information is not Knowledge, Knowledge is not Wisdom, Wisdom is not Truth, Truth is not Beauty, Beauty is not Love, Love is not Music, Music is the best.
 
That is impressively strange. Especially since the objects you're working with in ASP should be exclusively server-side. The real differences between FF and IE are in the way they handle the html generated by the scripts. An example of what I mean is that I've visited a page that was not carefully coded and tested - when they tried to enter nonbreakable spaces they entered &nbsp, but omitted the semicolon at the end. IE has no problem with this, and the page displays "fine" - but when viewed in FF you see literally &nbsp all over the page instead of the spaces inferred by IE. My suggestion, hence, is that you take a look at the page source on both the form page and the results page, since the appearance of field=1234 in IE vs FF may be a result of ambiguously generated html. Checking the source of the page from inside the browser may provide the insight you're looking for. Otherwise you can post it here for secondary opinions. Good luck, hope you can get some help out of this.
 
yes, it is strange. I looked at the source code from inside the browser and could not find any html form elements named "field".

Information is not Knowledge, Knowledge is not Wisdom, Wisdom is not Truth, Truth is not Beauty, Beauty is not Love, Love is not Music, Music is the best.
 
What about form elements inside of the image.asp page? Since you're using it as an include within the bounds of your html form on a page, perhaps something is being carried over?
 
>yes, it is strange. I looked at the source code from inside the browser and could not find any html form elements named "field".
Strange may it be. But you do not necessary be able to see the html form element named "field" from "view-source". The field can be generated by script.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top