开发者

Dojo form get value

I wrote the code using dojo where it shows on the screen two inputs and a button.

When i click the button it is supposed to show on console the following information:

  • Result of form validation
  • The values in the form

The validate() works fine.

The get( 'value' ) is always an empty object.

So, whats wrong?

Why the get( 'value' ) is always and empty object?

var div_form = dojo.create( "div", {}, dojo.byId( 'application' ), 'last' );
var form = new dijit.form.Form( { id:'mekie' }, div_form );

var div_email = dojo.开发者_JS百科create( "div", {}, form.id, 'last' );
var div_password = dojo.create( "div", {}, form.id, 'last' );
var div_button = dojo.create( "div", {}, form.id, 'last' );

var email = new dijit.form.ValidationTextBox( { type: 'text', required: true, id:'email' }, div_email );
var password = new dijit.form.ValidationTextBox( { type: 'password', required: true, id:'password' }, div_password );
var button = new dijit.form.Button( {  label: 'Enviar' }, div_button );

dojo.connect( button, 'onClick', function()
{
    var test = dijit.byId( form.id );
    console.warn( 'click', test, test.validate(), test.get( 'value' ) );
});

Thanks in advance.


You should set the attribute name on each input.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜