orchidsoftware / platform

Orchid is a @laravel package that allows for rapid application development of back-office applications, admin/user panels, and dashboards.
https://orchid.software
MIT License
4.26k stars 631 forks source link

Listener + Client-side validation #2674

Closed johnnuman closed 11 months ago

johnnuman commented 11 months ago

Discussed in https://github.com/orgs/orchidsoftware/discussions/2673

Originally posted by **johnnuman** July 19, 2023 **Background** I have a complex layout comprising of multiple fields. - Some of those fields are required which will trigger a client-side validation if left empty. - I have one listener on the page which has different relation fields related to Address namely Country, City, Area, Street address. The City, Area and Street Address fields are hidden initially and only populate step by step upon selection of previous data i.e. once the Country is selected then City control becomes visible and loads cities related to the selected country and once City is selected, Area control becomes visible loading all areas in that city and so on. This all works perfectly fine thanks to the Listener. **Challenge** Since these fields are on a Listener layout, as soon as the information is changed in Country, City or Area Relation Field, it triggers a callback which triggers a client-side validation. If the user has filled other required fields on the page already then this call is smooth and without errors but if there are any required fields yet to be filled, a client-side validation error is triggered and I do not like this UX. I'd like to somehow disable the client-side validation while the listener is updating and only trigger validation when save button is clicked. Since my layout also has multiple tabs, so many times, there are required fields on the other non-active tabs and user is not aware of validation error on those tabs until he clicks on it and this becomes frustrating experience for them. Any suggestions are welcome and I thank in advance for all those who take time to assist me with it.
tabuna commented 11 months ago

Did you encounter this on the latest version?

johnnuman commented 11 months ago

It is 14.0.0-alpha5. Is such issue addressed in latest version?

tabuna commented 11 months ago

I don't encounter this problem in the stable release

johnnuman commented 11 months ago

OK. let me upgrade and get back to you on this. Thank you for your prompt communication.

johnnuman commented 11 months ago

Upgrading to 14.6 solved this issue. Thank you.