$(function () { new $.module['form'] ( $('.save-form'), { before: function () { if (!$('#agree').is(':checked')) { alert("You must agree to the purpose of collection and use of your personal information."); return false; } return true; }, success: function (module, insert_id) { location.href = '/eng/sub020103/completed/report_id/' + insert_id }, page_exit: true, jgrow: true } ); $('#anonymous').change(function () { if ($(this).is(':checked')) { $('#name').val('anonymous'); $('#email, #tel').val(' '); $('#name, #email, #tel').prop('disabled', true); $('#agree2').prop('disabled', true).prop('checked', false); } else { $('#name, #email, #tel').prop('disabled', false); $('#agree2').removeAttr('disabled'); $('#name').val(''); $('#email, #tel').val(''); } }); })