Homepage
Main navigation
Main content
Additional information
October Tricks
Login / Sign up
Quality Guidelines
About
GitHub
Propose new content
October CMS resources and help articles
Simple and to the point. Optimized by the community.
×
Login / Sign up
Quality Guidelines
About
GitHub
Propose new content
Edit trick
Changes will be published after manual review
Title
Give your trick a describing title. Do
not
start with «How to...».
Your trick
Keep it short and concise! Markdown is supported.
Do you find yourself needing to alert your users when they attempt to leave a form that has changes on it? October make's it easy to do just that! This trick explains how you can enable input monitoring for your backend forms. Assuming you have: 1. Created your own plugin 2. A controller with form behavior implemented 3. Used default create and update partials **Instructions** 1. Navigate to the desired controller folder in your plugin directory (i.e. /plugins/author/plugin/controllers/controller) 2. Open the desired partial (i.e. update.htm or create.htm) 3. Modify the `Form::open()` statement with the following code: ``` <?= Form::open([ 'class' => 'layout', 'data-change-monitor' => 'data-change-monitor', 'data-window-close-confirm'=>'There is unsaved data!' ]) ?> ``` 4. Save the partial 5. Visit the desired form behavior 6. Make change to one of the fields 7. Try to reload or leave the page 8. Notice the alert indicating there are changes > You can repeat this process for additional forms and/or actions as desired ![image](https://user-images.githubusercontent.com/28734844/74668169-42f5a700-516a-11ea-8704-8d3df814da1a.png)
References
Add additional online resources to your trick
×
Name
URL
+ Add reference
Topics
If your trick fits more than one topic select multiple. Select at least one.
Backend
Plugin Development
CMS
Twig
Themes
Deployment
Tags
You can use existing tags or create new ones. Add at least one.
Submit for review
Cancel
We use cookies to measure the performance of this website. Do you want to accept these cookies?
Accept
Decline