1
<label for="date1">Drop down Date box:</label>
<input type="text" name="date1" id="date1" value="2005-12-30"
    data-dojo-type="dijit/form/DateTextBox"
    required="true" />

What happens: The third statement doesnt work for me and what I get in result is a simple text box. Whats required: I want to get a x number of date text boxes. Where x is retrieved from database.

1
  • 1
    What dojo version do you use?
    – nozzleman
    Nov 27, 2012 at 10:45

5 Answers 5

2

You have a mix of the old dojo declarative syntax and the newer html5 compatible syntax. The "data-" piece is used for the newer html5 syntax.

As pointed out by OammieR, you also don't use the "/" in the declaration and it should be a ".". See below for example.

<input id="date1" data-dojo-type="dijit.form.DateTextBox"
    data-dojo-props="required:true,name:'date1',value:'2005-12-30'" />
0

Try the below one

<input type="text" 
                                   placeholder="Date of Birth"
                                   name="date" 
                                   dojoType="dijit.form.DateTextBox"
                                   required="true" 
                                   >
0

If you use the new version(AMD). When require you have to use xxx/xxx/xxxx

but in data-dojo-type you have to use xxx.xxx.xxx instead.

Here is an example.

0

I am facing same problem and get this solution. Before using AMD syntax in declarative you have to require module which is used to create widgets like:-

In your case first you have to require widget

require(["dojo/parser","dijit/form/DateTextBox"],function(parser,DateTextBox)
{
    parser.parse();
});

as your creating widget declarative your have to parse your code also.

In HTML:-

<label for="date1">Drop down Date box:</label>
<input type="text" name="date1" id="date1" value="2005-12-30"
    data-dojo-type="dijit/form/DateTextBox"
    required="true" />

Now your free to use either xxx/xxx/xxxx or xxx.xxx.xxxx. I hope this will help you...

0

Well, If you are using dojo AMD then below is the code to add a dijit DateTextBox dynamically.

  require(["dijit/form/DateTextBox", "dojo/dom-construct",  "dojo/domReady!"],function(DateTextBox, domConstruct)
    {
        var parentNode = domConstruct.create("div", { "class": "container" }, mainContainer); // place this container in your main conatainer.
        var Date = new DateTextBox({
                name="date1",
                id="date1",
                value="2005-12-30"
              }, parentNode);          
        });

Note: if you are creating this in loop or multiple date picket at a time take care of id because id should be unique and should not be repeated.

Hope this will help you :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.