admin管理员组

文章数量:1387360

<input type="text" name="date" value="" dojoType="dijit.form.DateTextBox" required="true" />

I want to avoid dojoType for 2 reasons:

  • parseonload makes it "jump" onload (you see system-default input-fields for some time onload)

  • It is not validating HTML

so whats the alternative?

<input type="text" name="date" value="" dojoType="dijit.form.DateTextBox" required="true" />

I want to avoid dojoType for 2 reasons:

  • parseonload makes it "jump" onload (you see system-default input-fields for some time onload)

  • It is not validating HTML

so whats the alternative?

Share Improve this question edited Nov 14, 2011 at 14:08 hugomg 70.1k29 gold badges165 silver badges255 bronze badges asked Nov 14, 2011 at 13:10 iceteeaiceteea 1,2243 gold badges20 silver badges35 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 8

There are a couple of different approaches to your issue:

Use Programmatic creation of dijit widgets. instead of specifying dojoType on elements, you can create and place the widgets through javascript programmatically. In the dojo reference docs, you'll notice most ponents have a declarative example and a programmatic example (for example, dijit.form.Select). The programmatic style allows you to avoid placing dijit ponents directly in your html markup.

Also, Dojo 1.6 offers a new style of placing attributes on declarative ponents. Rather than specifying dojoType, you can use data-dojo-type. More information on this new feature can be found here.

You can solve the parseOnLoad issue a couple of ways. One way is hiding the page content until the parsing has pleted. The dijit theme tester does this. You'll notice when you load the page you will initially see a message about the page loading, then the fully populated page will fade in.

To have valid HTML, from Dojo 1.6 onwards you can use data-dojo-XXX attributes instead of the dojoXXX ones. The HTML5 spec reserves the "data-" prefix for this sort of user-defined attribute.

http://dojotoolkit/features/1.6/html5data-attributes

本文标签: javascriptdojoType alternativeStack Overflow