Jump to content

jquery plugin not resetting form


Agony

Recommended Posts

jquery.form.js library. The alert i added there shows up, so it does succeed and work there.

    if (options.resetForm) {       alert('eeffeS');       callbacks.push(function() { $form.resetForm(); });    }

this alerts as well:

    options.success = function(data, status, xhr) { // jQuery 1.4+ passes xhr as 3rd arg        var context = options.context || this ;    // jQuery 1.4+ supports scope context        for (var i=0, max=callbacks.length; i < max; i++) {            callbacks[i].apply(context, [data, status, xhr || $form, $form]);        }        alert('eeffeS');    };
/** * Resets the form data.  Causes all form elements to be reset to their original value. */$.fn.resetForm = function() {    return this.each(function() {        // guard against an input with the name of 'reset'        // note that IE reports the reset function as an 'object'        if (typeof this.reset == 'function' || (typeof this.reset == 'object' && !this.reset.nodeType)) {            this.reset();        }    });};

it all works - but the resetForm: true that is sent as a parameter and runs the function above on success fails to reset the form.

once code runs it does this:

$('#submit-btn').hide();$('#loading-img').show();

but the function above doesn't seem to reset it to default values.

Link to comment
Share on other sites

nop, no error messages. that's why i don't understand why its not working.It should just reset the form to original values ( hide the image, show the button) - but button stays hidden and image wont vanish.using console.log or alert in the code sections that lead to it - works fine. But the function itself doesn't seem to get called.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...