New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
@keydown doesn't work with vgform:input #171
Comments
I should also point out that it's possible to use |
In case anyone else comes across this, the workaround that worked for me was to use
|
Yeah, this has to do with the fact that For now, your workaround seems okay or you might want to consider just using a regular I plan to do some more experimentation with forms soon and I'm sure better patterns will emerge from this. |
Yup, I'm using the workaround above with a regular |
See #250 We need to make a decision on what if anything needs to change in the vgforms package for a v1.0. |
Describe the bug
I'm trying to create a small form where the user enters values into different fields, and can hit enter while focusing on any of them and have that data submit. It seems the way to do this would be something like:
vgform:
components to bind their values to fields of the component and make them easy to access and easy to clear on submit@keydown
to point to a function that checks to see if the key was enter, and if so, submit. (Other options exist here, but they all take the form of using an@event
on thevgform:
component.But this doesn't compile:
vgcomp.keydown undefined (type *vgform.Input has no field or method keydown)
Software Versions
Vugu version: 0.3.3
Go version: 1.15.2
Browser and version: Testing on Chrome 86, though don't think it's applicable here
To Reproduce
Expected behavior
This should compile.
Keydown(e)
should effectively do nothing until the enter key is pressed. When the user enters text into "name",c.Name
should be updated to reflect it. When the user presses enter, the code at the comment is executed.Thanks!
The text was updated successfully, but these errors were encountered: