Klenkes Posted December 12, 2017 Share Posted December 12, 2017 The more I work on projects that have lots of fields, lets say on a produkt page, I miss an "Apply" button that saves silently in the background without reloading the page. Imagine your fields are organized in fieldsets, and for a good overview they are set collapsed. Each time you save your page you start new by scrolling down, look for your fieldset, open your fieldset, look for your field, and place the cursor again where you left off. Example: Unless there already is a feature like that and I missed it this is my feature request. 2 Link to comment Share on other sites More sharing options...
dragan Posted December 12, 2017 Share Posted December 12, 2017 The Admin on Steroids module has that feature (and tons more) - you can choose to have CTRL + S to save the page. Link to comment Share on other sites More sharing options...
Klenkes Posted December 12, 2017 Author Share Posted December 12, 2017 I know. But unfortunately it's just an ordinary save action and the page is reloaded with scroll to the top of the page and all fields closed again 1 Link to comment Share on other sites More sharing options...
Zeka Posted December 12, 2017 Share Posted December 12, 2017 Hi @Klenkes I have never tried this module, but from the description, it looks like, partially, what you are looking for. https://github.com/somatonic/AutoSave 3 Link to comment Share on other sites More sharing options...
Klenkes Posted December 12, 2017 Author Share Posted December 12, 2017 Ah thanks. I will take a look at it! Autosave may not be an option but maybe it can be adapted to use an ordinary button. Link to comment Share on other sites More sharing options...
szabesz Posted December 12, 2017 Share Posted December 12, 2017 If your project's budget permits: https://www.youtube.com/watch?v=Bohhf3aK8gU Unfortunately, I do not have ProDrafts (yet) but it seems to save with AJAX (and not just when AutoSaving) so you might wan to investigate how it actually works. 1 Link to comment Share on other sites More sharing options...
Klenkes Posted December 12, 2017 Author Share Posted December 12, 2017 Budget is not the problem, I love Ryans ProModules! But I never had the need for ProDrafts with all its fancy features and just for an apply button? But it would be worth it. Just to peek into it and see how it is done. 2 Link to comment Share on other sites More sharing options...
Klenkes Posted December 12, 2017 Author Share Posted December 12, 2017 Turns out it wasn't that hard after all! I "reworked" Somas AutoSave to my needs and, to my own surprise, it works fine. Have to test it though on more complex page structures and fieldtypes. After three years "living" with PW I am still amazed how easy some things are. Even for me. 4 Link to comment Share on other sites More sharing options...
adrian Posted December 12, 2017 Share Posted December 12, 2017 1 hour ago, Klenkes said: Turns out it wasn't that hard after all! I "reworked" Somas AutoSave to my needs and, to my own surprise, it works fine. Have to test it though on more complex page structures and fieldtypes. After three years "living" with PW I am still amazed how easy some things are. Even for me. Do you feel like sharing your version at some point? Others might find it useful also! 4 Link to comment Share on other sites More sharing options...
Klenkes Posted December 12, 2017 Author Share Posted December 12, 2017 3 hours ago, adrian said: Do you feel like sharing your version at some point? Others might find it useful also! Well... there it is: https://github.com/Klenkes/AjaxSave At the moment the only configurable setting is the button text. I tested with all kinds of configurations and found no problems except admin theme UiKit shows the message box twice for a second. I'm sure the module could use a "cleaning" hand from a Pro 5 Link to comment Share on other sites More sharing options...
Robin S Posted December 12, 2017 Share Posted December 12, 2017 10 minutes ago, Klenkes said: Well... there it is: https://github.com/Klenkes/AjaxSave Cool, thanks for this! A couple of little issues I noticed after a quick try-out: 1. You have undefined variables $buttontext and $href in addAjaxSaveButton(). 2. It would be good to set a default value for the button text, both in the module config inputfield and in a construct() method, in case a user does not save the module config after installation or a user saves the config inputfield in an empty state. Other thoughts: 1. I see the module submits the form to a separate Process module. Seems like it should be possible to instead do an AJAX submission to the "action" url of the form in ProcessPageEdit, but maybe there is a good reason not to do it this way. 2. It would be cool if the module could handle/show errors in the submission - e.g. empty required fields or other inputfield errors. 2 Link to comment Share on other sites More sharing options...
Klenkes Posted December 13, 2017 Author Share Posted December 13, 2017 12 hours ago, Robin S said: Cool, thanks for this! A couple of little issues I noticed after a quick try-out: 1. You have undefined variables $buttontext and $href in addAjaxSaveButton(). 2. It would be good to set a default value for the button text, both in the module config inputfield and in a construct() method, in case a user does not save the module config after installation or a user saves the config inputfield in an empty state. Thanks for the pointers. I cleaned up the variables and added default values for the button. Also got rid of the generation of the second button. Is a copy anyway. 12 hours ago, Robin S said: Other thoughts: 1. I see the module submits the form to a separate Process module. Seems like it should be possible to instead do an AJAX submission to the "action" url of the form in ProcessPageEdit, but maybe there is a good reason not to do it this way. 2. It would be cool if the module could handle/show errors in the submission - e.g. empty required fields or other inputfield errors. I agree. This would be cool but perhaps beyond my skills as I patched stuff together from AutoSave. I will look into it... 1 Link to comment Share on other sites More sharing options...
Klenkes Posted December 13, 2017 Author Share Posted December 13, 2017 16 minutes ago, Klenkes said: 2. It would be cool if the module could handle/show errors in the submission - e.g. empty required fields or other inputfield errors. Looks like it handled required fields right from the start. 2 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now