Two forms same page?

B3y steven 12/1/2009 9:13:00 PM

I have a page that has two forms in the same page, the catch is the second form is nested inside the first form. Well this violates W3C, and it seems that IE8 doesn't work with it. Color me surprised that IE8 actually is doing what it suppose to do according to the HTML specs.

Anyhow I needed this to work for my form to function and I was limited on time. So here is what I did to make the submit work with IE8.

1. Remove the "Submit" on the Button and just make it plain button ('<input type="button" id="Save" value="Save" />)
2. Add some jQuery magic to submit the first (the outer) form;

$("#Save").click(function() {
     var form = $("form:first").serialize();
	 $.ajax({
	     type: "POST",
		 url: "/Tickets/Edit/",
		 data: form,
		 success: function(msg) {
		     window.location = '/Tickets/Details/';
	     }
	});
});

Enjoy!

Tags: , ,

Add comment


(Will show your Gravatar icon)

  Country flag

biuquote
  • Comment
  • Preview
Loading



Powered By BlogEngine Enhanced with Snapshots

About the author

Steven Hildreth Steven Hildreth
Proof that anyone can setup a blog.

E-mail me LinkedIn Profile

Send mail Sign in

Recent posts