Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

dojoType 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?

like image 353
iceteea Avatar asked Mar 08 '26 12:03

iceteea


1 Answers

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 components have a declarative example and a programmatic example (for example, dijit.form.Select). The programmatic style allows you to avoid placing dijit components directly in your html markup.

Also, Dojo 1.6 offers a new style of placing attributes on declarative components. 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 completed. 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.

like image 163
BuffaloBuffalo Avatar answered Mar 10 '26 00:03

BuffaloBuffalo