views:

81

answers:

5

I have a form which submits fine in FF, Opera, Safari, Chrome, and also IE8... But it wont submit in IE6, or IE7...

I have noticed it is 99% sure that the problem is a too long querystring. I have many many options...

Now, changing the method to POST is out of the question here, so don't bother asking about this please...

I wonder, is there any other workaround for this problem? Also, why is only IE6 and IE7 having this problem?

If there is no workaround, will "disabling" the "too many" inputs which are over the limit help shortening the querystring? In other words, will disabled form elements also be added to the querystring?

Thanks

+1  A: 

If you're sure that that's the issue, and not the million other cross browser problems, you could try an ajax call. Split up the query into 2, 3, n calls.

Is it just a form? May I ask why POST is out of the question?

hookedonwinter
A: 

its not great, but you could putt the value(s) in a cookie

Ivo
Cookies also have per-browser length limits, this would just be the same problem in a different guise.
Marc B
+1  A: 

Hi,

To answer your second question, Microsoft's got the answer here: http://support.microsoft.com/kb/208427 The maximum URL is 2,083 characters, so the page resulting from the GET request must have a URL shorter than that.

To answer your third question, w3.org/TR/html401/interact/forms.html#h-17.12: "Disabled controls can not be successful", i.e. they will not submit.

To answer your first, perhaps you can put a character limit on some of the fields, like a textarea. Another option might be to compress the input using javascript, hashing it somehow, and then unhashing it server-side on the submitted page.

dmrnj
Didn't quite get the part about disabled inputs... So by disabling them, I could shorten the querystring or not?
Camran
By "they will not submit" and "can not be successful," yes, they will not be part of the query string.
dmrnj
Yes, but "it can be successful" in solving my problem, that was the part which was confusing... So I will make a js code for disabling all other inputs when form is entered, except those needed... thanks
Camran
@Camran: But does that solve the actual problem? I suppose you need the data after all. If it's not sent, you can't do anything with it and the input field would be useless anyway.
Marcel Korpel
@Marcel: Exactly, this is why I will disable all useless inputs. Just to clarify a little, the inputs are "Select options" which are alot. And based on category, js shows divs containing the options. However, all other divs are invisible, but their options for the respective categories are not. By disabling them, I will shorten the querystring significantly. This hasn't been a problem in any browser except IE, so I never thought of it. Thanks
Camran
@Camran That sounds precisely why your form input might be so long, and probably answers what everyone suspected, in why you wouldn't want to POST.
dmrnj
A: 

To answer your last question first Disabled form inputs are NOT GETted or POSTed back to the server

If posting isn't an option, you can try eliminate non-essential form inputs, and although cheesy, reduce the length of the NAMEs of your elements will also shorten the Querystring.

nonnb
A: 

You can also try to do some client side compression of the query string values in JavaScript.

I have had some success using base 93 encryption to get a significant reduction in string size.

You can also try huffman compression, although it is more processor heavy.

http://rumkin.com/tools/compression/compress_huff.php

If you are only expecting a limited character set (lowercase a-z) you could come up with a few other tricks.

Matt
In all cases you have to rely on Javascript for this; though nice workarounds, they're merely an ugly hack of a problem that shouldn't exist anyway.
Marcel Korpel
True it is probably best to use post, or if you have a really long form, maybe split it into a number of sub forms. However I have had some cases where using JS compression has been very helpful. In particular when sending data over a JSONP cross domain API. If you have a known number of characters you will be sending, selecting an appropriate base for encoding can significantly shorten the strings you are sending, and the JS overhead is fairly low. Still much more appropriate for JS heavy web apps, than a standard form submit.
Matt