I changed the text field value via javascript. Now when I get the text field value in java it is unchanged. Is there a way to get the changed value in javascript?
Does anyone have an answer?
Could you please attach a small demo project or at least code snippet that demonstrates how you update TextField value using JS code?
Regards,
Gleb
const picker = new EmojiButton();
const trigger = document.getElementById('messageInput');
picker.on('emoji', selection => {
trigger.value = trigger.value + selection.emoji;
});
When you change text-field
value this way, it doesn’t fire ‘value’ property change event, so server side doesn’t know about it. This is done to prevent client side attacks, e.g. if you have a button disabled by security permissions, attacker could change it state using JS code and invoke forbidden operation. Fortunately, this is not a case in Vaadin and Jmix.
In your case, you need to implement server side integration for EmojiButton
and update TextField value using Java code.
Regards,
Gleb