Agony Posted May 29, 2014 Share Posted May 29, 2014 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 More sharing options...
justsomeguy Posted May 29, 2014 Share Posted May 29, 2014 Are you getting any error messages in the developer console? You are trying to set all of the fields to the values they had when they page loaded, right? Link to comment Share on other sites More sharing options...
Agony Posted June 1, 2014 Author Share Posted June 1, 2014 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 More sharing options...
justsomeguy Posted June 2, 2014 Share Posted June 2, 2014 A default reset button doesn't change CSS, it changes all of the values in the form elements to be the values they had when the page loaded. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now