最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - How to create a password input with Dojo? - Stack Overflow

programmeradmin3浏览0评论

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:

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.

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:

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.

Share Improve this question asked Nov 5, 2013 at 9:21 Brady ZhuBrady Zhu 1,4055 gold badges23 silver badges45 bronze badges 2
  • which dojo version do you use? – nozzleman Commented Nov 5, 2013 at 9:25
  • and which browser & version? 'cause this works for me see jsfiddle/HkXtr/1 – nozzleman Commented Nov 5, 2013 at 9:29
Add a ment  | 

3 Answers 3

Reset to default 5

Try to use the type param

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

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");

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

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

you can check it live JSFIDDLE

发布评论

评论列表(0)

  1. 暂无评论