Jump to content

Silent Save / Apply


Klenkes
 Share

Recommended Posts

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:

edit-deep-down.thumb.png.40fa55b1539a50ebd22a981b1835dbda.png

Unless there already is a feature like that and I missed it this is my feature request.

  • Like 2
Link to comment
Share on other sites

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.

  • Like 2
Link to comment
Share on other sites

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.

  • Like 4
Link to comment
Share on other sites

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!

  • Like 4
Link to comment
Share on other sites

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 ;)

  • Like 5
Link to comment
Share on other sites

10 minutes ago, Klenkes 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.

 

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.

  • Like 2
Link to comment
Share on other sites

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...

  • Like 1
Link to comment
Share on other sites

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.

  • Like 2
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...