I'm making a query site, it has an input field and next to it a "consult" button. I want the button to be pressed through the "enter" key.
I already put the (Is form Default) to "yes" but it doesn't work.
Hi Vinicius,
default button click trigger on enter key only when the input field and button are inside the form only. So could you please confirm both input field and button are inside form. If not please try to put them inside form then make the button default Yes, it should work.
regards
It works, thanks!
I had put the input and buttons inside a container, so it wasn't working. but after putting both inside a form, it worked perfectly.
Hope to find you well.
The action that your default button is running is refreshing the query? Does the button works correctly if you press it with mouse click?
Can you share some prints of the correspondent code to verify if something is missing?
Hope this can help.
Best regards,
Ricardo
Hi Ricardo, thanks for your attention.
I'll send some pictures, hope it helps.
Hi,
Thanks! Can you please share prints from the "ConsultarOnClick" action? Maybe something there isn't working. Is any kind of warning associated with the button? I saw an orange square around it in one of the prints (maybe the warning that the default is only valid for buttons inside forms).
Can you please validate if the functionality works with the mouse click?
Maybe you can check here a solution to your problem:
https://www.outsystems.com/forums/discussion/56620/is-default-button-on-reactive-web/
It's a similar case.
Thank you!
Hello Ricardo, an unforeseen situation has arisen and I will have to make a trip now, unfortunately I will not be able to check it now, but tomorrow as soon as I arrive I will see the details you sent and I will give you the answer here. Thank you very much for your attention.
Hi Ricardo, here are the pictures
Hi @Vinicius Perpetuo , Try hitting the Client action through a JS Script that is triggered while Enter Key got a hit.
eg:
const handleKeyPress = (event) => {
if (event.key === 'Enter' || event.keyCode === 13) {
// Perform your desired action here
$actions.ConsultarButtonOnClick(); ---> Client Action
}
};
document.addEventListener('keydown', handleKeyPress);
return () => {
document.removeEventListener('keydown', handleKeyPress);
Hello Jerome, an unforeseen situation has arisen and I will have to make a trip now, unfortunately I will not be able to check it now, but tomorrow as soon as I arrive I will see the details you sent and I will give you the answer here. Thank you very much for your attention.
Hi @Vinicius Perpetuo , Any update here.