Can we use ajax on text field? #646
-
I am creating an "a bit complex" form. After a lot of using of new After user change a select, we need to prepopulate a text field with a value based both on other form fields AND db. The ideal, in this case, should be to have But this is not the way it works now... so ... any ideas? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
The current implementation as you say does not contemplate ajax for text fields. You can write a simple script inside your let form = element.closest('form');
fetch(https://your-endpoint, {form: form.serializeArray()})
.then(data => {
console.log('Response data:', data);
})
.catch(error => {
console.error('Fetch error:', error);
}); Cheers |
Beta Was this translation helpful? Give feedback.
I think if we ever implement something like ajax for all the fields it would be using some other technology like livewire or similar. And it will bring full ajax forms functionality including validation etc.
Implementing this in all fields now just for the "dependency" would be a huge change without the full benefits of an ajax solution.
I am not sure if/how/when we are going to do it, I would like to have it for sure, but for now we need to stick to a bit more work to create those special use cases, sorry 🙏