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

Cannot submit a form inside a charm #884

Closed
ericpreisig opened this issue Oct 19, 2016 · 3 comments
Closed

Cannot submit a form inside a charm #884

ericpreisig opened this issue Oct 19, 2016 · 3 comments

Comments

@ericpreisig
Copy link

Hello,
because of the "e.preventDefault();" (line 3941) in the metro.js, we cannot submit any form inside the charm which is really annoying. (I was stuck for 2 hours on this bug)

Maybe we can remove this "e.preventDefault();" I didn't found in what it was useful maybe you guys know ?

@mschop
Copy link

mschop commented Dec 7, 2016

+1

@olton
Copy link
Owner

olton commented Dec 7, 2016

I did remove close charms on document click and preventDefaul an d StopPropogation linked with this. This fixed in develop branch

@sutherland007
Copy link

sutherland007 commented Oct 9, 2017

I've found a way you can close charms by clicking outside them using the document click event and submit inside a charm with no problems by adding this:

$(document).on('click', function(e){
     $('[data-role=charm]').each(function(i, el){
        if(!$(e.target).closest(el).length){
             if (!$(el).hasClass('keep-open') && $(el).data('displayed')===true) {
                 $(el).data('charm').close();
             }
        }
     });
 });

I've tested it with ruby on rails (using firefox and vivaldi) and nw.js, it worked perfectly fine, My solution is based on this link consider it for metro ui 4 and the current version.

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

No branches or pull requests

4 participants