Hi all,
I am using Mike's ajaxSubmit method but I am running into a weird problem.

Basically I have a page which allows you to rename folders using a form
which is bound by the ajaxForm. The ajax returns perfectly and updates the
new folder name with out a problem.

It gets weird though if I try to change another folder name after that. When
the server returns the result, the current folder name is changed properly
and the one that was previously changed also gets the ajax update, even
though this div was not targeted.

I assume that the problem lies in the fact that I am using the same form for
each edit and changing the form's values prior to submitting. When I bind
the ajaxForm, it's like it concantenated the new target to the previous one
(or creating an array) - not really sure. BUt if I edit two folders and then
do a third, all 3 folders take on the third name . The ajax call is updating
all the previous divs - so I think my assumption is correct.

Is there a way to unbind the form or clearing it before binding it again -
so it's starting fresh?

Here's the code that changes the form values and binds the form to the
ajaxForm:

function setFormValues(theForm,var1,var2,var3, var4, var5){
        
        document.forms[theForm].PageID.value=var1;
        document.forms[theForm].PageName.value=var2;
        document.forms[theForm].targetDiv.value=var3;
        document.forms[theForm].theCount.value=var4;
        document.forms[theForm].navLevel.value=var5;
        
        var options = { 
        target:        '#' + var3,   // target element(s) to be updated with
server response 
        beforeSubmit:  showRequest,  // pre-submit callback 
        success:       showResponse,  // post-submit callback 
                
    }; 
        
 
    // bind to the form's submit event 
    $('#' + theForm).submit(function() { 
        // inside event callbacks 'this' is the DOM element so we first 
        // wrap it in a jQuery object and then invoke ajaxSubmit 
        $(this).ajaxSubmit(options); 
                
        // !!! Important !!! 
        // always return false to prevent standard browser submit and page
navigation 
        return false; 
        });
}

Thanks for your help!!!!!
-- 
View this message in context: 
http://www.nabble.com/ajaxSubmit-multiple-targets-problem-tf3693715s15494.html#a10328513
Sent from the JQuery mailing list archive at Nabble.com.

Reply via email to