Unsaved Changes

Episode #423 by Teacher's Avatar David Kimura

Summary

In this episode, we'll look at creating a stimulus controller that will alert the user if there are unsaved changes on a form before they navigate away from the page or reload the site.
rails stimulusjs form 11:47

Chapters

  • Introduction (0:00)
  • Setting up the scaffold (1:25)
  • Setting up the view (3:20)
  • Creating the stimulus controller (4:33)
  • Handling Page Reloads (6:12)
  • Demo handling Page Reload (7:14)
  • Handling Anchor Clicks (8:11)
  • Demo handling Anchor Clicks (9:39)
  • Demo with different input types (9:58)
  • Final thoughts (11:10)
Student & Teacher
$ 9 /mo

Valid School Email Required

Same Access as Pro

Subscribe Now
Pro Monthly
$ 19 /mo

Access to Pro Episodes

Invite to Slack Channel

Priority Suggestions

Ad Free

Subscribe Now
Pro Annual
Autumn Sale
$ 144 190 /yr

Access to Pro Episodes

Invite to Slack Channel

Priority Suggestions

Ad Free

Subscribe Now
Teams
$ 57 /mo

3 Users Minimum

$19.00 / user / month

Same Access as Pro

Subscribe to Teams