Sha256: 14a41693744af589aaf99708eea3e17132efbc9db847b50edd0c1e3cce5effc0
Contents?: true
Size: 1.36 KB
Versions: 1
Compression:
Stored size: 1.36 KB
Contents
const formHelper = () => { const loadingForm = document.querySelector(".pb_form_loading") if (loadingForm) { loadingForm.addEventListener("submit", function(event) { event.preventDefault(); const submitButton = event['submitter']; const cancelButton = event['target'].querySelector('button[type="reset"]'); if (submitButton) { let currentClass = submitButton.className; let newClass = currentClass.replace("_enabled", "_disabled_loading"); let cancelClass = cancelButton.className; let newCancelClass = cancelClass.replace("_enabled", "_disabled"); submitButton.disabled = true; submitButton.className = newClass; if (cancelButton) { cancelButton.disabled = true; cancelButton.className = newCancelClass; } setTimeout(function() { submitButton.disabled = false; submitButton.className = currentClass; if (cancelButton) { cancelButton.disabled = false; cancelButton.className = cancelClass; } }, 5000); } this.submit(); }); } }; export default formHelper;
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
playbook_ui-14.5.0.pre.alpha.PLAY1510railsformloading3975 | app/pb_kits/playbook/pb_form/formHelper.js |