tags:

views:

3433

answers:

5

I have code from an old website that I needed to modify. There are two pages that I modified some form code in. I modified the max length of a textbox and I modified slightly a line or two of code in a function. The "btnSubmit_Click" function as it happens.

With the new code FTPed up on the webserver, when I click on the "Submit" button using Firefox 3, the button does what it is supposed to do. With IE7, nothing happens. No page load, no refresh, no error, no nothing. IE isn't busy, it doesn't time out, it does nada.

On my development laptop however, when I run the project, the submit button works in IE7 as it is supposed to do.

Any thoughts?

Response to Mecki: It is method=POST, but it is a JavaScript postback thing alright. Also I checked the outputted HTML and the Submit button has a JS "onclick" event:
onclick="if (typeof(Page_ClientValidate) == 'function') Page_ClientValidate(); "

Absolutely though all the required fields have what they need. The validation also works as when I test it by leaving out info from a required field IE7 asks me to fill in the data. Strange one.

A: 

Is the submit button really submitting the form (sending out a post/get) or is it calling JavaScript code to perform checks or other actions? If so, my first guess is some JS error happening. You should have a look at the JS console? (In case IE has one, not using IE myself, however, according to this MS page, it has one, you just need to enable it).

Mecki
+3  A: 

I've just seen exactly the same problem when porting an ASP site to ASP.NET. I have a form that submits just fine in Firefox, Safari, Chrome - but does absolutely nothing in IE or Opera. Like your form, it's not doing anything, not throwing any errors etc - it simply sits there doing nothing. Unlike your form, this is a plain old postback - it's not using anything client-side to trigger the form submission, no client-side validation etc.

If I attach an onclick handler to the submit button, I can see that the button is being clicked - but if I attach an onsubmit handler to the form, I get nothing. If I make the button onclick handler submit the form through JavaScript, it works fine - it's just the direct submission that's not working.

After banging my head against the desk for a while, I realised that there was another form on the page - in this case created by a function in a separate class, so out of sight and out of mind. In ASP, there was no problem - the two forms were separate. ASP.NET, of course, had wrapped the page in it's own form and HTML doesn't allow nested forms. I'd removed the form tags around the main form that I was working with, but I'd overlooked the second form because it was elsewhere on the page and elsewhere in the code. So IE and Opera were ignoring the nested form (correctly, I assume) but Firefox et al were being more forgiving and allowing the form to submit.

This is a classic example of an error that one wouldn't make when writing the code from scratch but that's all too easy to make when porting code in bulk where something written long ago has a side effect that's not immediately visible in the code you're working on.

This may or may not be related to your problem, but it might help anyone else with a similar problem who comes across this question looking for possible answers.

Simon Forrest
I've actually had that happen to me before, I'd forgotten about it. Unfortunately just had a quick look at the code that is vexing me, and it basically validates. I'll have to double check, because your solution feels right!
Seanchán
+4  A: 

The question was not complete, I left out a detail which in hindsight is very important: I also was moving the site from one host to another.

The issue seems to have been differing versions of the Validating JavaScript code. I fixed the issue by copying the aspnet_client\systemweb\1_1_4322\*.* directory from the root of IIS to the root of the website. The website I had transferred, already had code in this directory and it must have been a different Build version or something from the ASP running on the new server.

Apologies Mecki, if I was any good with JavaScript your answer would have lead me in the right direction, I'd say. Simon, it was while investigating your idea that I noticed the javascript includes for aspnet_client. End of the day the issue was fixed with trial and error on my part so I don't absolutely know what caused my problem. Thanks for helping.

Seanchán
A: 

I just had the same problem. Just make sure you don't nest tags. Or if you are doing this with a google search box you can check out this guide for a work around:

http://www.codeproject.com/KB/aspnet/CustomSearchEngine.aspx

Bryan Denny
A: 

adding helps

Don't really understand this comment. Add what to help what?
Seanchán