Forcing blur() on form field before save in RelationManager (double-click issue)
Hi,
I'm having an issue with a form within a RelationManager in Filament v3. I'm using live(onBlur: true) on several form fields to dynamically recalculate values using afterStateUpdated and a custom calculator class.
The problem is that if the user edits a field and then directly clicks the "Save" button (without clicking outside the field, i.e., without triggering blur()), the form doesn't submit on the first click. Only the second click actually submits the form. This is because the first click triggers the recalculations, but the actual form submission only happens on the second click.
I'd like the form to submit on the first click, even if the user hasn't "blurred" the last edited field.
Is there an elegant way to programmatically force blur() on the active form field before the form is submitted in a RelationManager? I'm looking for a solution that is as aligned with the Filament philosophy as possible and doesn't require "dirty" DOM manipulation.
Is there a way to easily customize the attributes of the "Save" button within the form inside the RelationManager's modal/slide-over? If so, I could add the x-on:click directly to that button.
Alternatively, is there another recommended method for solving this problem?
Thanks in advance for your help!
0 Replies