views:

540

answers:

2

I'm looking for a good example that shows how to handle (in the controller) a POST onchange (of a input["text"] for example)

Currently when I set my onchange = form[0].submit(); and I watch the action hit the controller, the HTTP verb is still GET for some odd reason. But when I view source the form on the page has the method="POST" ... so what am I doing wrong?

+1  A: 

Are you able to make use of an ajax library (jquery, ms, whatever) and set up a post for the call instead?

"The javascript submit() method does not fire the onsubmit event, but bypasses it and directly submits the form. " - http://www.webmasterworld.com/forum91/4047.htm

mannish
Here's another solution: http://stackoverflow.com/questions/133925/javascript-post-request-like-a-form-submit
mannish
Now that you mention it, I actually need to do this via XHR - thanks for the secondary post!
Toran Billups
+1  A: 

you should put

return false

at the end of submit event handler function

Marko