problems with ajax and functions in an ajaxForm submit

problems with ajax and functions in an ajaxForm submit

I am using ajaxForm() to show completion percent during a submit that can be either an original submit or and update/edit submit to an existing post. A user should be able to edit their content in a database row in a later session, after the original submit. If a variable (coming from the database) has content, the update/edit branch is activated to submit the edited post back into the same database row.

Highly summarized, this code both submits and does an update/edit to an existing post in a database row, but the submit button has to be clicked twice - not nice.

    var submitOptions = {
            beforeSend: function(e) {
                if( $( "#propertyID" ).val() ){                                       
                    var submitOptions4Update = {
                        //this url option in ajaxForm() calls a different url than the original form action
                        url: '../phpFunctions/updater.php',
                        target: '#messages',               
                        complete: function() {
                              //clear the form, if update is successful                                             
                    };
                    $('#dataInput').ajaxForm( submitOptions4Update );
                    e.preventDefault(); //stop the original Submit?
                }
            },
            target: '#messages',
            complete: function() {
                  //clear the form, if upload is successful
            }
      });
      //this expression calls the url in the original form action=" ... " statement
      $('#dataInput').ajaxForm( submitOptions );

Thinking that I declared the beforeSend function and the second click executes it, I put () at the end of that function. So the beforeSend now looks like:

            beforeSend: function(e) {
                if( $( "#propertyID" ).val() ){                                       
                    var submitOptions4Update = {
                        //same code as above                                             
                    };
                    $('#dataInput').ajaxForm( submitOptions4Update );
                    e.preventDefault(); //stop the original Submit?
                }           
            }(),

This executes on 1 click of the Submit button for both original submits and update/edits to existing posts. However, using alerts in various places, I found that none of the beforeSend function executes with this code. Attempted update/edits generate a MySQL error because no branch occurs and $('#dataInput').ajaxForm( submitOptions ); submits to an existing row.

The documentation for beforeSend is not clear to me. It says - " This is an Ajax Event. Returning false in the beforeSend function will cancel the request. As of jQuery 1.5, the beforeSend option will be called regardless of the type of request." So will a function using preventDefault in jQuery 1.8 be called or be cancelled. I can't figure out what that would mean here. I'm also not clear about function calls (); versus function references, so that may be part of the problem, as well.

What has to change to get 1 click to execute in both scenarios - original submit and update/edit ?