Here is a patched version of the ajaxForm function that fixes the
problem.
$.fn.ajaxForm = function(options) {
return this.ajaxFormUnbind().bind('submit.form-plugin', function() {
$(this).ajaxSubmit(options);
return false;
}).bind('click.form-plugin', function(e) {
var $el = $(e.target);
var target = e.target;
if (!($el.is(":submit,input:image"))) {
var $parent = $el.closest(":submit");
if ($parent.length)
target = $parent[0];
else
return;
}
var form = this;
form.clk = target;
if (target.type == 'image') {
if (e.offsetX != undefined) {
form.clk_x = e.offsetX;
form.clk_y = e.offsetY;
} else if (typeof $.fn.offset == 'function') { // try
to use
dimensions plugin
var offset = $el.offset();
form.clk_x = e.pageX - offset.left;
form.clk_y = e.pageY - offset.top;
} else {
form.clk_x = e.pageX - target.offsetLeft;
form.clk_y = e.pageY - target.offsetTop;
}
}
// clear form vars
setTimeout(function() { form.clk = form.clk_x = form.clk_y =
null; }, 10);
});
};
On Nov 4, 8:44 am, petersendidit wrote:
> I have a form with 2 button elements in it. Button elements are used
> because they are much easier to style as needed.
>
>
>
> Save
> Save As Copy
>
>
> I am using the jquery form plugin (http://jquery.malsup.com/form/) to
> submit the form by ajax. Everything works great in all browsers
> except for Safari and Chrome. The problem in Safari and Chrome is
> that the name of the button that was pressed does not get sent back.
> My guess is that the form plugin is getting confused by the span
> inside the button and not grabbing the name from the button element.
> Is there a way to fix this?