473,396 Members | 1,996 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

for i in Request.From problem

Hi All

Using: JScript
IIS 5

I have a problem in the following code:

// The next 4 lines display exactly what was typed in the text boxes.
out("<br>Request.Form="+ Request.Form("Box1").Item);
out("<br>Request.Form="+ Request.Form("Box2").Item);
out("<br>Request.Form="+ Request.Form("Box3").Item);
out("<br>Request.Form="+ Request.Form("Box4").Item);
out("<br>typeof="+ typeof Request.Form); //returns "object"
// Problem here
for (var i in Request.Form) {
out('Element Text:' + Request.Form(i).Item);
}

[snipped rest]
My Problem is that the for loop is not going through each element of
the form and displaying. it just seems to skip those 3 line and
continues with the code, no errors and no text. The values are stored
in the form elements as the 5 lines of output above clarifies this
fact.

Can anyone spot the problem please???

Thanks.

Al.

Jul 19 '05 #1
2 1733
*Harag* wrote:
Hi All

Using: JScript
IIS 5
[snip]
// Problem here
for (var i in Request.Form) {
out('Element Text:' + Request.Form(i).Item);
}
[snip]
Can anyone spot the problem please???


I don't think Request.Form is enumerable in that way, here's the version
I use:

function EnumeratePostData() {
var objO = [];
for (var e = new Enumerator(Request.Form); !e.atEnd(); e.moveNext()) {
var key = e.item();
var count = Request.Form(key).Count;
for (var i=1; i<=count; ++i) {
objO.push(Server.HTMLEncode(key) + "=" +
Server.HTMLEncode(Request.Form(key).Item(i)));
}
}
return objO.join("\r\n");
}
--
Andrew Urquhart
- FAQ: http://www.aspfaq.com
- Archive: http://tinyurl.com/38kzx (Google Groups)
- Contact me: http://andrewu.co.uk/contact/
- This post is probably time-stamped +1 hour - blame my ISP (NTL)
Jul 19 '05 #2
On Tue, 17 Aug 2004 12:08:47 GMT, "Andrew Urquhart"
<us**************************@spam.invalid> wrote:
*Harag* wrote:
Hi All

Using: JScript
IIS 5

[snip]
// Problem here
for (var i in Request.Form) {
out('Element Text:' + Request.Form(i).Item);
}


[snip]
Can anyone spot the problem please???


I don't think Request.Form is enumerable in that way, here's the version
I use:

function EnumeratePostData() {
var objO = [];
for (var e = new Enumerator(Request.Form); !e.atEnd(); e.moveNext()) {
var key = e.item();
var count = Request.Form(key).Count;
for (var i=1; i<=count; ++i) {
objO.push(Server.HTMLEncode(key) + "=" +
Server.HTMLEncode(Request.Form(key).Item(i)));
}
}
return objO.join("\r\n");
}


for (var e = new Enumerator(Request.Form); !e.atEnd(); e.moveNext())
Cool the above works a treat now. thanks.

(heads off to read up on Enumerator)

Al.
Jul 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Daniel Rimmelzwaan | last post by:
I want to send a biztalk document to an aspx page, and I need to see some sample code, because I just can't make it work. I have a port with transport type HTTP, pointing to my aspx page, something...
6
by: Ammar | last post by:
Dear All, I'm facing a small problem. I have a portal web site, that contains articles, for each article, the end user can send a comment about the article. The problem is: I the comment length...
4
by: Jit Prasad | last post by:
I have a working client-side Vb.Net (.net v1.0) app that talks to a Webspere webservice on a windows 2000 server. The client side app runs on a citrix server, also a Windows 2000 server. The app...
7
by: SevDer | last post by:
Hi I have a class library that needs to download the HTML in a specific page of ours with provided querystring. When I open this URL with any browser, it loads fine. When I do WebRequest from Web...
8
by: Tim Reynolds | last post by:
Our .Net application calls a web method of aplpication 2 that resides on their Apache server. When I as a developer C#, Studios 2003, make the call to their web method from my desktop, I receive no...
14
by: Harry Keck | last post by:
I have client side code that uses xmlhttp to make an asyncronous call to the server. This call really churns the server and can take a couple of minutes to finish. I have found that while this...
18
by: Thomas Lunsford | last post by:
I have inherited a set of asp pages that I now need to augment. In order to minimize changes to production code, I would like to make a "call" to an asp page from a new asp page. Existing code is...
5
by: Rory Becker | last post by:
I have had code in my Application_Start which is intended to run once at the start of my application's life. It loads connection information and similar from a known location. However I...
3
by: Joseph Geretz | last post by:
I'm using the Request Filter documentation which can be found here: http://msdn.microsoft.com/en-us/library/system.web.httprequest.filter.aspx In this example, two filters are installed, one...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.