QSelect with new values and confirmation
-
This is with quasar v1.
I am using the @new-value event with QSelect, and would like to pop up a QDialog to get confirmation before the new value is added. The QDialog code is being executed all right, but the dialog is cleared immediately because of the Enter key which is used to trigger the @new-value event.
Is there simple way to stop the Enter key propagating to the QDialog?
-
I’m not certain what you mean with the enter key, but does this do what you want?
https://codepen.io/smolinari/pen/exwzrJ
If not, can you edit the pen as to how you are doing it?
Scott
-
This pen shows what I’m doing, using “use-input” and “@new-value”
https://codepen.io/ctrengove/pen/jdjgWE
So you can just type in the QSelect and hit Enter, then @new-value is fired. However, it turns out that this pen works! The dialog is displayed and you can choose to confirm or not. In my actual code (which connects to a server to add the new option) the dialog gets closed automatically, so there must be something else going on.
I’ll play around with it further.
Chris
-
So now this shows the actual problem:
https://codepen.io/ctrengove/pen/jdjgWE
If the dialog contains a prompt, then the Enter key which is used to trigger the @new-value event in QSelect is passed on and is captured by the dialog which is then immediately closed. So I believe that the QSelect component needs to prevent propagation of the keystroke.
-
Ok. I see. This is above my head in the end. Maybe someone else can get your version working.
But, I got my version working with your select, just with a dialog component instead of the method. (it’s better anyway IMHO, because you can design the confirmation dialog as you’d like it.)
https://codepen.io/smolinari/pen/exwzrJ
Scott
-
mmmm… I really wish that was not implemented. I’m trying to catch the enter keystroke at the q-select with no luck.
I need to catch when the user hits the enter key and branch to a few paths depending on some factors present at the form. But while I can successfully catch ESC key for example, ENTER keep failing.
Any help? Is the q-select preventing it to bubble?
Thanks!