Sha256: 29809ffa51ac5480497358347624182381e0ab9f19a8b706720f7ab7b9139406
Contents?: true
Size: 909 Bytes
Versions: 68
Compression:
Stored size: 909 Bytes
Contents
;(function() { $(document).on('page:change', function() { // look for form elements that are optional, but suggested and // visible on the page // warn participants with a prompt if these elements are left empty $('form').on('submit', function() { var $suggestedInputs = $(this).find('.suggested:visible'); var emptyInputsPresent = $suggestedInputs.filter(function(i, el) { return $(el).val() === ""; }).length > 0; var $suggestedRadioInputs = $(this).find('.suggested-radio:visible'); emptyInputsPresent = emptyInputsPresent || $suggestedRadioInputs.filter(function(i, el) { return typeof $(el).find('input:radio:checked').val() === "undefined"; }).length > 0; if (emptyInputsPresent && confirm('You have not completed this form, are you sure you want to continue?') === false) { return false; } }); }); })();
Version data entries
68 entries across 68 versions & 1 rubygems