Sha256: 38f9c09ae4e8f132ada578a7ef2e9eab3dcad1f494e6cf9a0d05409694fe5258
Contents?: true
Size: 1.37 KB
Versions: 157
Compression:
Stored size: 1.37 KB
Contents
<%= pb_form_with(scope: :example, url: "", method: :get, loading: true) do |form| %> <%= form.text_field :example_text_field, props: { label: true } %> <%= form.actions do |action| %> <%= action.submit %> <%= action.button props: { type: "reset", text: "Cancel", variant: "secondary" } %> <% end %> <% end %> <script> 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("_disabled_loading", "_enabled"); let cancelClass = cancelButton ? cancelButton.className : ""; let newCancelClass = cancelClass.replace("_disabled", "_enabled"); setTimeout(function() { submitButton.disabled = false; submitButton.className = currentClass; if (cancelButton) { cancelButton.disabled = false; cancelButton.className = cancelClass; } }, 5000); } }); } </script>
Version data entries
157 entries across 157 versions & 2 rubygems