I've seen this in AGE, but it may be in AGO also (haven't found a place to test it yet)
I have a custom widget acting as a form, but a user noted that if they press the enter (return key) as if they were typing this into an old terminal style form, that the screen/tab in browser goes blank.
And sure enough it does. Note that you have the questionmark waiting for a query field, but it appeared to wipe out everything in the query string including the data_id (recently selected), and the id which lets it know which experience to load from the server.
The strange thing is, it does this after I transition to the form collection page, and not when I use a text box to auto generate a search as I type. So I'm not sure if this is a default EXB behavior or not.
I am considering intercepting that key, and not letting it do anything unless its on one of the actual buttons on the widget as a possible solution. I know there used to be a nodeJS method to disable some defaults so not sure if this is related to it.
SO my question is two fold:
1. About how it currently seems to work:
a. Has anyone else experienced this in EXB?
b. Is it normal and expected behavior?
c. What is the recommended option to solve this?
2. When building forms like this that have to be in a widget (rather than say Survey123), do a lot of users still expect to move through the tab slots, and hit enter only at the end?
3. Any suggested best practices for this ?
(I know there could be accessibility concern here too, and that may complicate this fix)
Solved! Go to Solution.
https://www.w3schools.com/react/react_forms.asp
It sounds like an issue related to how React handles forms in the Virtual DOM vs standard HTML. You may need to add in some event.preventDefault() handlers.
https://www.w3schools.com/react/react_forms.asp
It sounds like an issue related to how React handles forms in the Virtual DOM vs standard HTML. You may need to add in some event.preventDefault() handlers.
Yeah this matches much of what I was thinking. I haven't gotten to fixing this yet, but there used to be a command to turn off defaults, but in some cases that's not ideal, so intercepting the event, and having it literally do practically nothing to prevent the submission may be what's needed. Given noone else has another idea that's likely what I'll end up doing when I get back to that code.