I have a page with the following properties: Several non-form input elements (a text field, a few buttons). There is an "add file" and a "remove file" button. Whenever the "add file" is clicked, new_file_count is incremented and a form is created (ID: "nc-" + new_file_count, NAME: "ncform", enctype: "multipart/form-data"). Whenever "remove file" is clicked, the last form is removed, and new_file_count is decrimented. Each form has a hidden submit element named "NEW_SUBMIT". There is also a text field button, when it is clicked, a hidden field in each form is updated, along with the text in a span element within each form. This works properly. Finally, there is the non-form "Check in documents" button. When this is clicked, the function LAC_NEW_CHECKIN_CLICK is called (see end of mail). This should iterate through each form, and submit it, and the alerts I put in the validation function would suggest it is doing that. However, when the actual LAC_submit_checkin function is executed, the checkin is not being executed as AJAX (I'm redirected to the json output of the first form).
Any idea what would could cause causing this? The AJAX setup/trigger is in LAC_submit_checkin Thanks, -Jim function LAC_NEW_CHECKIN_CLICK() { LAC_form_invalid = false; var v = $("#ContractNumber")[0].value; if(!v) { LAC_form_invalid = true; } forms = $("[NAME='ncform']"); forms.each(LAC_validate_checkin); if(!LAC_form_invalid) { alert("Checkin will progress"); forms.each(LAC_submit_checkin); } } function LAC_submit_checkin(index) { var myform = $(this) var mysubmit = $(myform.find("[NAME='NEW_SUBMIT']")); var contract = $("#ContractNumber")[0].value; var id = $(myform.find("[NAME='file_count_id']")[0].value); var options = { dataType: 'json', success: LAC_NEW_CheckInSuccess(myform, contract, id), beforeSubmit: LAC_NEW_CheckInPreSubmit(myform, contract, id) }; // bind form using 'ajaxForm' myform.ajaxForm(options); mysubmit.trigger("click"); //mysubmit.ajaxSubmit() has the same effect } function LAC_NEW_CheckInSuccess(form, contract, id) { return function(data) { var ld = data.LocalData; var status_code = parseInt(ld.StatusCode); var status_reason = ld.StatusReason; var status_message = ld.StatusMessage; var ddoctitle = ld.dDocTitle; if(ld == 0) { log_event("LAC_" + contract + "_" + id, " submission successful", "success"); } else { log_event("LAC_" + contract + "_" + id, " submission failed (" + status_code + "): " + status_message + "<BR>>>" + status_reason, "error"); } form.remove(); } } function LAC_NEW_CheckInPreSubmit(form, contract, id) { /*generate the function to provide final form data alterations, and move the form*/ return function() { id=pad_string(id, 3); dDocTitle=form.find("[NAME='dDocTitle']"); dDocTitle.setAttribute("MAXLENGTH", "80"); dDocTitle[0].value = "(" + contract + ") " + dDocTitle[0].value; log_event("LAC_" + contract + "_" + id, " submitted", "message"); /*make sure the form isn't destroyed*/ $("#LAC_NEW_BUCKET").append(form); } }