Skip to content
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

enterSubmit issues #5

Closed
blowsie opened this issue Mar 26, 2015 · 3 comments
Closed

enterSubmit issues #5

blowsie opened this issue Mar 26, 2015 · 3 comments
Labels

Comments

@blowsie
Copy link
Contributor

blowsie commented Mar 26, 2015

Great Plugin!

I noticed that enterSubmit does not submit my form.
Do you have a working example of this?

I'm doing something like this at the moment, It does not submit the form

HTML

<form ng-submit="login()">
<!--- Inputs --->
 <input                  type="password"
                             name="password"
                             data-ng-model="credentials.password"
                             ng-virtual-keyboard="{kt: 'numeric', enterSubmit:true}"
                             required="">
</form>

JS

 VKI_CONFIG.layout.numeric = {
          'name'   : 'numeric',
          'keys': [
            [['1', '1'], ['2', '2'], ['3', '3']],
            [['4', '4'], ['5', '5'], ['6', '6']],
            [['7', '7'], ['8', '8'], ['9', '9']],
            [['←', 'Bksp'], ['0', '0'], ['↵', 'Enter']]
          ]
        };
@blowsie
Copy link
Contributor Author

blowsie commented Mar 26, 2015

Looking at the plugin code, It seems there is nothing to transform the enterSubmit configuration do work with angular.

@blowsie
Copy link
Contributor Author

blowsie commented Mar 26, 2015

Ok so true did not work, but passing in the submit function without parenthesis works.

 ng-virtual-keyboard="{kt: 'numeric', enterSubmit:login}"

@the-darc the-darc added the bug label Mar 29, 2015
@the-darc
Copy link
Owner

It is a bug in the vki-core.js#L591. Currently, when you use enterSubmit:true the directive calls the native browser HTMLFormElement.submit() function.

According to the method documentation:

The form's onsubmit event handler (for example, onsubmit="return false;") will not be triggered when invoking this method from Gecko-based applications. In general, it is not guaranteed to be invoked by HTML user agents.

And the Angular's ngSubmit directive works based on the form submit event. As result the enterSubmit vki's configuration will only work for the native form submition functionality and will not work for the Angular's ng-submit.

I think that use a callback method in the enterSubmit vki's configuration (like @blowsie suggested) is the better and simpler solution for this case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants