Brady Zhu
Brady Zhu

Reputation: 1405

How to create a password input with Dojo?

I really get confused when I'm attempting to create a password input with Dojo, the following is the related code fragment:

HTML: <input id="password" type="password">

JavaScript:

var passwordInput = new ValidationTextBox({
    name: "password",
}, "password");

I seems that the input with type of password doesn't work and the below is the effect sketches, which is the plaintext: enter image description here

Meanwhile, I cannot find another Dojo widget can use as a password purpose, and I also don't think Dojo doesn't support it. So can anybody give me ideas on this issue?

Thnaks in advance.

Upvotes: 0

Views: 4741

Answers (3)

Bibhuti
Bibhuti

Reputation: 41

You can create it by the following two ways:

1.Declarative example:

<input id="password" name="password" type="password"  required="true" data-dojo-type="dijit/form/ValidationTextBox" tabindex="0" invalidMessage:'Please enter password.'">

2.Programmatic example

var password = new ValidationTextBox({
    name: "password",
    type: "password"
}, "password");

Upvotes: 4

Mithlesh Kumar
Mithlesh Kumar

Reputation: 758

Instead of ValidationTextBox use TextBox and set property type:'password'

new TextBox({
  type:'password'
},'pass');

you can check it live JSFIDDLE

Upvotes: 0

Jorgeblom
Jorgeblom

Reputation: 3578

Try to use the type param

var passwordInput = new ValidationTextBox({
    type: "password"
}, "password");

Upvotes: 5

Related Questions