orchidsoftware / orchidsoftware/platform
Modal with validation errors block another modal to show content
@tabuna is already working on this.
Since Feb 6, 2024.
- Dominant language
- PHP
- Stars
- 4.8k
- Forks
- 662
- Avg merge
- 1d 9h
- Merged PRs (30d)
- 7
Description
Bug description
In the screen, I have multiple modals. The first modal is triggered by the "Create Client" button (it displays a form for creating/editing a client). The next modal for editing a client is triggered as an action on a record in a table row.
After clicking "Add Client," I fill in the details for the new client and submit. If the server returns validation errors, I close the modal without saving using the "Close" button, clicking outside the modal, or the close icon in the corner.
Then, I click the "Edit Client" action on a table row, but instead of showing me the modal with the retrieved data, it displays the modal from the "Create Client" action with error messages.
The modals for creating and editing a client have the same form, only the methods for saving and retrieving data differ.
The issue is caused by /orchid/platform/resources/js/controller/modal_controller.js, which in the open method checks if the modal contains elements with the CSS class .invalid-feedback. If it does, the data is not asynchronously loaded (asyncLoadData).
To Reproduce
- In command bar in table layout add action create (modal toggle)
- Create table with records and add column with action edit (modal toggle)
- Both modals for edit & create have same form (content)
- Click on create button
- Fill modal with worng data & submit, you retrieve errors from server
- Close modal for create
- In table row click on button edit, which show modal. Modal show content from action create and dont run asyncLoadData from server
Expected behavior
If different modals share the same layout as content but have different links for asynchronously fetching data and saving, I would expect the modal content to be displayed according to the respective link for asynchronous data retrieval and saving.
One possible solution would be to create a modal hash based on parameters, or after closing the modal, return the modal to its original state without errors.
Screenshots
- detail screen
- click create client & fill data & apply
- after close modal create client + try to click on edit client
- loaded modal - edit client with data & errors from create client modal
- normal edit .... create modal with error was not triggered before
Desktop (please complete the following information):
- OS: Ubuntu 22.04.3 LTS
- Browser Chrome / Firefox
- Version newest
Server (please complete the following information):
- Platfrom Version: 14.15
- Laravel Version: 10.32
- PHP Version: 8.1.27
- Database: Mysql
- Database Version: >5.6 (doesn't matter)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.