(validate) Submit button value
|
View:
New views
3 Messages
—
Rating Filter:
Alert me
|
|
|
(validate) Submit button valueI have a form on which I'm using the validation plug-in, and I'm
having a problem retrieving the values of the two submit buttons I have on the form if I add a remote call to one of my textboxes. I have two submit buttons: <input class="submit" type="submit" value="save" name="button" /> <input class="submit" type="submit" value="next" name="button" /> I also have a textbox with a remote validation on it. If I remove the remote validation, I can retrieve the value of the input named "button" on the server side, but if I keep the remote validation, the form submits without posting any value for "button" at all. Does anyone know what may be happening here? |
|
|
Re: (validate) Submit button valueIts a bug in the validation plugin. The remote method cancels the actual submit event, loosing the information about the submitting button. The same workaround that is currently in place for the submitHandler-option needs to be applied here. You could help by filing an issue here: http://plugins.jquery.com/project/issues/validate (requires registration/login).
Until then, this may be a viable workaround: $(":submit").click(function() { var hidden = $(this.form).find("input:hidden[name=button]") if (!hidden.length) { hidden = $("<input type='hidden' name='button'").appendTo(this.form); } hidden.value = this.value; }); That create or update a hidden input with the necessary name and set its value to the button the user clicked on. You may need to remove the name-attribute from those buttons, so that only one value for "button" gets submitted. Jörn On Fri, Nov 6, 2009 at 4:30 PM, Bret W <bretwalker@...> wrote: I have a form on which I'm using the validation plug-in, and I'm |
|
|
Re: (validate) Submit button valueThanks for the prompt response. I'll definitely file bug report if it will help. On Nov 6, 2009, at 11:23 AM, Jörn Zaefferer wrote: Its a bug in the validation plugin. The remote method cancels the actual submit event, loosing the information about the submitting button. The same workaround that is currently in place for the submitHandler-option needs to be applied here. You could help by filing an issue here: http://plugins.jquery.com/project/issues/validate (requires registration/login). |
| Free embeddable forum powered by Nabble | Forum Help |