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

footer.php: reset values in all modals after they are hidden #799

Closed
wants to merge 2 commits into from

Conversation

nellistc
Copy link
Contributor

@nellistc nellistc commented Nov 6, 2023

If a modal is hidden or dismissed (cancelled), any modified (but unsaved) values persist when the modal is opened again with the same record.

This change resets the modal when it is hidden so that saved values are shown the next time the modal is opened.

If a modal is hidden or dismissed (cancelled), any modified (but unsaved) values persist when the modal is opened again with the same record.
@wrongecho
Copy link
Collaborator

Test these changes at: https://resetmodals799.pr-review.itflow.org
(automatic message)

@wrongecho
Copy link
Collaborator

Hey, thanks for the PR!

My only issue with this is that (at least on mobile) modals can be dismissed by clicking outside them.
This presents an issue when someone is filling in a new/create modal as they then lose all they work they've done.

@nellistc
Copy link
Contributor Author

nellistc commented Nov 6, 2023

Yes, I was thinking about that as well. Setting data-backdrop="static" stops you from accidentially clicking out of it - maybe an option.

Only reset input values in modals where the ID does not start with "add". This keeps values when using a 'new record' modal and clears them when using an 'edit' modal.
Copy link

sonarqubecloud bot commented Nov 6, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@o-psi
Copy link
Contributor

o-psi commented Nov 6, 2023

I prefer the modal stays filled. I am working on java script code to save any forms to sessions, so if it the modal has a new ID, it will have the the same, otherwise not.

@nellistc
Copy link
Contributor Author

nellistc commented Nov 6, 2023

The latest change leaves the values in for any modals with an ID starting with add. Any others, it resets the form. For me, if I change something in an edit modal and then hit cancel, I don't expect to have the changed value there if I go back in. Worth making it an option in the config?

@johnnyq
Copy link
Collaborator

johnnyq commented Nov 20, 2023

closing pull request as we decided against this at this time but we do thank you for your contribution to ITFLow

@johnnyq johnnyq closed this Nov 20, 2023
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

Successfully merging this pull request may close these issues.

4 participants