The following block of code is failing to refill the EntryDate box with the date after the
$(form).clearForm();
var entry_date attempts to be outside of either of those functions and therefore accessible. But it doesn't appear to be. Do I need to make it global? Outside of all the functions in the file? Or is there a better way? Thanks!
function setupAjaxForm(form_id, form_validations){ var form = '#' + form_id; var form_message = 'server-message'; // en/disable submit button var disableSubmit = function(val){ $(form + ' input[type=submit]').attr('disabled', val); }; // setup loading message $(form).ajaxSend(function(){ //$('#server-message').removeClass().addClass('loading').html('Loading...').fadeIn(); }); // setup jQuery Plugin 'ajaxForm' var entry_date; var options = { dataType: 'json', beforeSubmit: function(){ if(!Validation()){ return false; } /***** FETCH THE VALUE HERE ****/ entry_date = $('#EntryDate').val(); disableSubmit(true); }, success: function(json){ $.blockUI({ message: json.message, css: { border: 'none', padding: '15px', backgroundColor: '#000', '-webkit-border-radius': '10px', '-moz-border-radius': '10px', opacity: '.5', color: '#fff' } }); setTimeout($.unblockUI, 2000); disableSubmit(false); if(json.type='success') $(form).clearForm(); $('#EntryDate').val(entry_date); } }; $(form).ajaxForm(options);}
Replying to your comment "That ... doesn't keep 49 from executing though. 48 certainly executes."
Actually it should. If you're having "=" instead of "==", script hits an error and stops at line 47 and never proceed.
That ... doesn't keep 49 from executing though. 48 certainly executes.