Hi all,

I have a submit button, and a function tied to it via $('form').submit
(function() { ... });  When the button is clicked, this function gets
executed, and the data gets sent to the server.  However, I also call
this function via a context menu option (i.e., $('form').submit()).
Again, the function gets executed, but the data does not get sent to
the server.  I added "return true;" as the last line of the submit
function, but that didn't seem to help.  Running the code through
Firebug, I noticed on line 2078 of jquery-1.2.6.js, there's a
comparison "val !== false".  When the button is clicked, this
comparison succeeds, and val is set to ret.  However, when I call the
function from the context menu, this comparison fails, and val is left
as undefined.

My question is, what's causing the difference?  Should I be doing
something different?  I've also tried $('form').trigger('submit'), and
$('#submit').click().  Neither work.  The last one appears to do
something completely different than what I expected.

My submit button's html is:
<input type="submit" id="submit" name="submit" value="save" />

Here's my function:
        $('form').submit(function() {
                clearEmptyRows();
                $('tr.deleted td:first-child input').each(function() {
                        if( !$(this).hasClass('KeyField') ) return;
                        $('form').append('<input type="hidden" value="' + 
this.value + '"
name="deleted"/>');
                });
                return true;
        });

And the call from the context menu function:
        $('form').submit();

What I need is a "Save" option from the context menu (and eventually,
a top menu), that does the same thing as the button does.  At some
point, we may remove the "save" button from the screen (or if
necessary, just hide it), so we'll need some way to submit the form.
Any help would be greatly appreciated.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"jQuery (English)" group.
To post to this group, send email to jquery-en@googlegroups.com
To unsubscribe from this group, send email to 
jquery-en+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/jquery-en?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to