Changes between Version 1 and Version 2 of AjaxPrototypeNewForms


Ignore:
Timestamp:
Mar 10, 2007, 6:22:23 AM (17 years ago)
Author:
Georgi Stanojevski <glisha gmail com>
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • AjaxPrototypeNewForms

    v1 v2  
    103103    // where to submit the form
    104104    var ajaxurl = aform.action;
     105    var formparameters = aform.serialize(true); // take the form field values before you disable it
     106
     107    //disable the form elements while beeing processed
     108   aform.disable();
    105109
    106110    // get the submit button of the form and show an ajax-loader instead
     
    116120        var myAjax = new Ajax.Request(
    117121        ajaxurl,
    118         { method: 'post', parameters: aform.serialize(true), onComplete: handlereq });
     122        { method: 'post',
     123          parameters: formparameters,
     124          onSucess: handlereq,
     125          onFailure: function() {alert('Refresh the Page, something happend to the server');} // what to do if the server return something else than 2xx status.
     126        });
    119127
    120128    function handlereq(req) {
     
    135143            });
    136144
    137         $('ajaxloader').remove() // remove the ajax-loader
    138         submitbutton.show() // return the submit button
     145        aform.enable(); // enable the form
     146        $('ajaxloader').remove(); // remove the ajax-loader
     147        submitbutton.show(); // return the submit button
    139148        }
    140149    }
Back to Top