views:

60

answers:

2

I have begin testing my application with IE and have found that buttons that are styled using JQuery UI button are posting their entire content to the server. This means that they post a span with the text inside it. This triggers a "A potentially dangerous Request.Form value was detected from the client" error in ASP.Net. This does not happen with <input type=Submit /> but does with Button elements. However I have button elements which trigger JavaScript and so should not be set up as <input type=Submit />.

How do I fix this? It seems that it must be common enough that there is a widely accepted solution but I haven't been able to find anything by searching.

A: 

I would take the type="submit" and change it to type="button" and then add the submit in the script after you do the other stuff needed.

<button type='button' id='mybutton'/>

$('#mybutton').click(function(){
   // do my stuff here with submit last
});
Mark Schultheiss
+3  A: 

Per your success: Removing the button name attribute solves the problem.

Stephen