Sha256: 14acdd284f6c85979a6459d82d2d8e787775da660d82bd697c61152166b6fb3b

Contents?: true

Size: 1.38 KB

Versions: 26

Compression:

Stored size: 1.38 KB

Contents

<%= pb_form_with(scope: :example, url: "", method: :get, loading: true) do |form| %>
  <%= form.text_field :example_text_field_loading, 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

26 entries across 26 versions & 2 rubygems

Version Path
playbook_ui_docs-14.8.0.pre.alpha.PLAY1649rolloutheightglobalprops4635 app/pb_kits/playbook/pb_form/docs/_form_form_with_loading.html.erb
playbook_ui-14.8.0.pre.alpha.PLAY1649rolloutheightglobalprops4635 app/pb_kits/playbook/pb_form/docs/_form_form_with_loading.html.erb
playbook_ui_docs-14.9.0.pre.rc.8 app/pb_kits/playbook/pb_form/docs/_form_form_with_loading.html.erb
playbook_ui-14.9.0.pre.rc.8 app/pb_kits/playbook/pb_form/docs/_form_form_with_loading.html.erb
playbook_ui_docs-14.8.0.pre.alpha.PLAY1598floatinguiupgrade4617 app/pb_kits/playbook/pb_form/docs/_form_form_with_loading.html.erb
playbook_ui-14.8.0.pre.alpha.PLAY1598floatinguiupgrade4617 app/pb_kits/playbook/pb_form/docs/_form_form_with_loading.html.erb
playbook_ui_docs-14.9.0.pre.rc.7 app/pb_kits/playbook/pb_form/docs/_form_form_with_loading.html.erb
playbook_ui-14.9.0.pre.rc.7 app/pb_kits/playbook/pb_form/docs/_form_form_with_loading.html.erb
playbook_ui_docs-14.8.0.pre.alpha.revert3916revert3893PBNTR667railstypeaheadformintegration4567 app/pb_kits/playbook/pb_form/docs/_form_form_with_loading.html.erb
playbook_ui-14.8.0.pre.alpha.revert3916revert3893PBNTR667railstypeaheadformintegration4567 app/pb_kits/playbook/pb_form/docs/_form_form_with_loading.html.erb
playbook_ui_docs-14.8.0.pre.alpha.revert3916revert3893PBNTR667railstypeaheadformintegration4565 app/pb_kits/playbook/pb_form/docs/_form_form_with_loading.html.erb
playbook_ui-14.8.0.pre.alpha.revert3916revert3893PBNTR667railstypeaheadformintegration4565 app/pb_kits/playbook/pb_form/docs/_form_form_with_loading.html.erb
playbook_ui_docs-14.7.0.pre.alpha.revert3916revert3893PBNTR667railstypeaheadformintegration4523 app/pb_kits/playbook/pb_form/docs/_form_form_with_loading.html.erb
playbook_ui-14.7.0.pre.alpha.revert3916revert3893PBNTR667railstypeaheadformintegration4523 app/pb_kits/playbook/pb_form/docs/_form_form_with_loading.html.erb
playbook_ui_docs-14.8.0.pre.rc.7 app/pb_kits/playbook/pb_form/docs/_form_form_with_loading.html.erb
playbook_ui-14.8.0.pre.rc.7 app/pb_kits/playbook/pb_form/docs/_form_form_with_loading.html.erb
playbook_ui_docs-14.8.0.pre.rc.6 app/pb_kits/playbook/pb_form/docs/_form_form_with_loading.html.erb
playbook_ui-14.8.0.pre.rc.6 app/pb_kits/playbook/pb_form/docs/_form_form_with_loading.html.erb
playbook_ui_docs-14.8.0.pre.rc.5 app/pb_kits/playbook/pb_form/docs/_form_form_with_loading.html.erb
playbook_ui-14.8.0.pre.rc.5 app/pb_kits/playbook/pb_form/docs/_form_form_with_loading.html.erb