var Qs_Form_Extend = { onSubmitSuccess: function (response, form) { var id = $(form).attr('id'); Qs_Form.setFormOption(id, 'response', response) if (response.isValid) { if (form) { var onSuccessCallback = Qs_Form.getFormOption($(form).attr('id'), 'onSuccessCallback'); if (typeof onSuccessCallback == 'undefined') { updateFieldsValue(); form.submit(); } else { Qs_Form.callExternal(onSuccessCallback); } } } else { var onErrorCallback = Qs_Form.getFormOption($(form).attr('id'), 'onErrorCallback'); if (typeof onErrorCallback != 'undefined') { Qs_Form.callExternal(onErrorCallback); return true; } Qs_Form.displayErrors(id); } return response; }, initExtendForm: function () { $.extend(Qs_Form, Qs_Form_Extend); } }