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 <petersendi...@gmail.com> wrote:
> I have a form with 2 button elements in it.  Button elements are used
> because they are much easier to style as needed.
>
> <form id="testform"  method="post" name="testform">
>         <input type="text" value="" name="firstname" id="firstname"/>
>         <button class="button ci_btn_shdw" value="Save As New " name="_event
> [aed_save]" type="submit"><span>Save</span></button>
>         <button class="button ci_btn_shdw" value="Save As Copy " name="_event
> [aed_copy]" type="submit"><span>Save As Copy</span></button>
> </form>
>
> 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?

Reply via email to