I am trying to create a multi-step form using a recursive function to find
the form, bind a submit event, and replace the form with either an error
message or a new form for the following step. This is what I have so far:

                $(function(){
                        bindForm = function(){
                                
$('#pgContentInner').find('form').submit(function(){                            
                                        $('#pgContentInner').hide('slow', 
function(){
                                                $('form').ajaxSubmit({
                                                        target: 
'#pgContentInner',
                                                        url: '/path/to/page',
                                                        method: 'post'
                                                });
                                        }).show('slow');        
                                        
                                        bindForm();
                                        return false;
                                });
                        }
                        
                        bindForm();
                });

This works fine for the first step (the form that is initially loaded), but
fails to bind to the newly loaded form after submit. I tried moving the
recursive call into the after/success callback of .ajaxSubmit, but it didn't
make any difference. Not sure what else to try. Any suggestions?

Thanks!
Jason



-- 
View this message in context: 
http://www.nabble.com/help-with-recursive-function-tf3039726.html#a8448540
Sent from the JQuery mailing list archive at Nabble.com.


_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/

Reply via email to