Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Save button in the administration section should "save in place" #2017

Open
kylemhall opened this issue Aug 23, 2024 · 3 comments
Open

Save button in the administration section should "save in place" #2017

kylemhall opened this issue Aug 23, 2024 · 3 comments

Comments

@kylemhall
Copy link
Member

Right now clicking the save icon in the administration causes the entire page to reload, and does not place the browser back on the section that was previously visible.
Submitting this form via a javascript POST would avoid this issue entirely. The response (200/4xx) can trigger a temporary message that the changes were saved successfully.

The following jquery is an example of how it could work:

$('#update-settings').on('click', function(e){
    e.preventDefault();
    $.post(url, $('#settings-form').serialize(), function(){
        DisplayMessage( "success", _("Settings updated.") );
    })
    .fail(function() {
        DisplayMessage( "error", _("Settings not updated.") );
    });
});
@mdnoble73
Copy link
Member

This would not account for all of the logic that takes place when the form is submitted and does not display messages that appear from the submittal.

@kylemhall
Copy link
Member Author

Bummer! So on the reload there are differences in the rendered page? I wonder if there is a way to get the browser to jump back to the visible area as an alternative. Something like https://brianshim.com/webtricks/scroll-back-to-form-after-submission-fake-ajax/ might work!

@mdnoble73
Copy link
Member

There is logic in the submit that tells it where to go back to. Every once in awhile that gets off. But fixing that logic is the way to go.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants