javascript - ember.js submitting and reading input hidden in controller -
i'm new in ember.js, , stucked trying submit form containing hidden field. goal build simple login form hidden field prevent crsf attacks.
when submit form triggering dologin action of controller can read input values passed form except hidden one.
here's view code using ember easy form:
<script type="text/x-handlebars" data-template-name="login/index"> <div class="row-fluid"> <section class="span5 offset6" id="login"> {{#form-for controller}} {{view ember.select name="pref" valuebinding="pref" content=prefix optionvaluepath="content.id" optionlabelpath="content.name" prompt="choose prefix"}} {{#input auth}} {{input-field auth placeholder="phone number"}} {{/input}} {{#input token}} {{input-field token as="hidden" value="121353262ae656256ffd236"}} {{/input}} {{#input pswd}} {{input-field pswd as="password" placeholder="password"}} {{/input}} <button {{action "dologin" target="controller" }}>login</button> {{/form-for}} </section> </div> </script>
here route, controller , underlying object:
app.loginindexroute = ember.route.extend({ model: function() { return indoona.login.create(); }, setupcontroller: function(controller, model) { controller.set("model", model); ember.$.getjson('http://my_rest_api.tld/voip/prefixes', function (response){ controller.set('prefix', response); }); } }); app.loginindexcontroller = ember.objectcontroller.extend({ actions: { dologin: function(){ var loginobj = this.get("model"); console.log('auth: ' + loginobj.auth); console.log('pswd: ' + loginobj.pswd); console.log('pref: ' + loginobj.pref); console.log('token: ' + loginobj.token); } }, prefix: [] }); app.login = ember.object.extend({ pref : "", auth : "", password : "", token : "" });
i've tried putting valuebinding
inside hidden no results i've tried using native ember input helper no results i've tried using native ember view render hidden field no results
someone give me hint?
Comments
Post a Comment