Ok im getting closer. This gives me the id for each form being submitted,
the alert(selector); in the external js fires off so its getting the
request, but the form now does not submit...just stis there laughing at me.

Page js:

<script type="text/javascript">
//dummy class added to button to test it out
 
$(".dummy").click(function () {
        var $this = $(this);

        var form_id = $this.closest("form").attr("id");  // get the form id

        //alert(form_id);
        uRec('#'+form_id);
        //return false; 
});


</script>

External js:

function uRec(selector){
        
        var $form = $(selector);
        
        alert(selector);
        
        $form.submit( function() {
                
        var data = $(form_id).serialize();
        var form_url = $(form_id).attr('action');
        var form_target = form_url.substr(1).replace( new RegExp( "/" ,"g"),
"_" );
        var update_target = (form_target.replace("_edit", ""));
        
        

        $.blockUI({ message: null});
                
                $form.ajaxSubmit({
                type: "post",
                url: form_url +'/',
                data: data,
                dataType: 'json',
                success: function(response){
                        
                        if (response.status === true) 
                        {
                                        $.unblockUI();
                                        $('#' +
update_target).html(response.html).slideToggle('slow').highlightFade({speed:
2000});
                                        $('#' +
form_target).slideToggle('slow');
                        } else {
                                
                                $.unblockUI();
                                $('#' + form_target).html(response.html);
                                
                        }
                }
                });
        return false;
        });
};

Reply via email to