javascript - HTML5 required attribute not working in Ember.js -
i creating login form ember.js application, , take advantage of 'required' attribute on inputs easy client-side validation. however, seems validation not work when add ember action submit button.
for example:
<form class="form" role="form"> <div class="form-group"> <label class="sr-only" for="exampleinputemail2">email address</label> <input type="email" class="form-control" id="email" placeholder="email address" required> </div> <div class="form-group"> <label class="sr-only" for="exampleinputpassword2">password</label> <input type="password" class="form-control" id="password" placeholder="password" required> </div> <div class="checkbox"> <label> <input type="checkbox"> remember me </label> </div> <div class="form-group"> <button {{action 'login'}} class="btn btn-success btn-block">sign in</button> </div> </form>
the moment remove {{action 'login'}}
validation works, otherwise not.
how can around issue? thanks.
adding action button circumvent form submit procedure, you'll want add form submit, , hit once form attempts submit.
<form class="form-horizontal" {{action "login" on="submit"}}> ... </form>
Comments
Post a Comment