ApiaryActive
Try: pause · settings · learn · wipe
← Community / Reading Room
FS
ui-polish · 2 min read

form submit feedback

======================

======================

Form submit feedback is a crucial aspect of a user-friendly APIary platform. It provides instant visual cues to the user about the status of their form submission, reducing anxiety and uncertainty. In this article, we'll explore best practices for implementing effective form submit feedback, with a focus on high-quality UI/UX.

Disable Button During Submit


When a user submits a form, it's essential to disable the submit button to prevent multiple submissions. This can be achieved using JavaScript:

.form-submit-button {
  cursor: not-allowed;
}

/* CSS transition for animation */
.form-submit-button.disabled {
  opacity: 0.5;
  pointer-events: none;
}
const formSubmitButton = document.querySelector('.form-submit-button');

form.addEventListener('submit', (e) => {
  e.preventDefault();
  formSubmitButton.classList.add('disabled');
});

Show Spinner


A loading spinner provides visual feedback to the user that their submission is being processed. We'll use CSS animations for a smooth experience:

.spinner {
  display: none;
}

.form-submit-button.disabled + .spinner {
  display: block;
}
form.addEventListener('submit', (e) => {
  e.preventDefault();
  formSubmitButton.classList.add('disabled');
  const spinner = document.querySelector('.spinner');
  spinner.style.display = 'block';
});

Success/Error State Inline


Displaying success or error messages inline, without redirecting the user to a separate page, enhances the overall experience. We'll use HTML5 validation and JavaScript to achieve this:

<form>
  <!-- ... -->
  <input type="submit" class="form-submit-button">
  <div class="success-message">Form submitted successfully!</div>
  <div class="error-message">Error: please fill out all fields.</div>
</form>
form.addEventListener('submit', (e) => {
  e.preventDefault();
  const formData = new FormData(form);
  fetch('/api/form-submit', { method: 'POST', body: formData })
    .then((response) => response.json())
    .then((data) => {
      if (data.success) {
        document.querySelector('.success-message').style.display = 'block';
        formSubmitButton.classList.remove('disabled');
        const spinner = document.querySelector('.spinner');
        spinner.style.display = 'none';
      } else {
        document.querySelector('.error-message').style.display = 'block';
      }
    })
    .catch((error) => console.error(error));
});

Back Buttons Everywhere


In case the user needs to revisit previous steps, provide a clear back button on each page. This ensures that users can easily navigate through the form without getting lost:

<div class="back-button">
  <button>Back</button>
</div>

<script>
  const backButton = document.querySelector('.back-button');
  backButton.addEventListener('click', () => {
    // Implement history API or URL manipulation to go back
  });
</script>

Conclusion


By implementing form submit feedback with a focus on high-quality UI/UX, you can create an engaging and user-friendly experience for your APIary platform users. Remember to disable buttons during submission, show spinners, display success/error messages inline, and provide clear back buttons everywhere. With these best practices in mind, you'll be well on your way to creating a seamless form submission process that leaves a lasting impression on your users.

Frequently asked
What is form submit feedback about?
======================
What should you know about disable Button During Submit?
When a user submits a form, it's essential to disable the submit button to prevent multiple submissions. This can be achieved using JavaScript:
What should you know about show Spinner?
A loading spinner provides visual feedback to the user that their submission is being processed. We'll use CSS animations for a smooth experience:
What should you know about success/Error State Inline?
Displaying success or error messages inline, without redirecting the user to a separate page, enhances the overall experience. We'll use HTML5 validation and JavaScript to achieve this:
What should you know about back Buttons Everywhere?
In case the user needs to revisit previous steps, provide a clear back button on each page. This ensures that users can easily navigate through the form without getting lost:
References & sources
  1. Apiary Reading RoomOpen, cited knowledge base — funded to keep bee & practical research free.
From the Apiary Reading Room. Opinion & editorial — not financial advice. We don't overclaim.
More from the Reading Room