A hint, not a question

Hi, just thought I'd share this hear as it took me a while to find the answer. If you need to populate a filament field from outside the alpine/livewire code (ie, in vanilla JS), do the following:
const targetField = document.getElementById('data.<field ID>');
targetField.value = event.data.html;
targetField.dispatchEvent(new Event('input'));
const targetField = document.getElementById('data.<field ID>');
targetField.value = event.data.html;
targetField.dispatchEvent(new Event('input'));
It's the event that's key, as that seems to update the actual alpine model, which then gets saved to the DB
Solution:
Solution above
Jump to solution
1 Reply
Solution
_andypeacock
_andypeacock3mo ago
Solution above
Want results from more Discord servers?
Add your server