Take the 2-minute tour ×

As far as I can judge, the CSS-Rule "dijitRequired" is used to mark a required input field. Yet, this style is not set when I apply the "required"-Attribute to a dijit, for example, a date dijit:

The Dijit is built as follows:

<input dojoType="dijit.form.DateTextBox" class="l" id="datumsTestID" name="datumsTest"  tabindex="5" value="2009-01-01" />

The Attribute is set with the following Javscript code

dijit.byId('datumsTestID').attr('required', true)

Am I doing something wrong or is the style "dijitRequired" not intended to be used as I assume?

For my purposes, I patched ValidationTextBox.js to set/unset the class, but is there a cleaner (meaning: more correct) way to set the class or can I style required fields using other attributes?

ValidationTextBox.js, Dojo 1.3, Line 116

    if (_12) dojo.addClass(this.domNode, "dijitRequired"); 
    else dojo.removeClass(this.domNode, "dijitRequired");
share|improve this question
add comment

1 Answer

Hmm, I don't see that code in ValidationTextBox.js or anywhere else. My _setRequiredAttr() in 1.3 is:

_setRequiredAttr: function(/*Boolean*/ value){
this.required = value;
dijit.setWaiState(this.focusNode,"required", value);

Actually I don't see any references to dijitRequired at all, maybe that's something you added to your local copy?

share|improve this answer
It is true, the reference to dijitRequired ist in my local copy. I have added it because I needed the Dijit to "look" required when they are set to required. My issue is also explained in the next post: Would it be possible to add this to the Dojo ValidationTextBox, for me it looks as if my patched version (below) should be the default behaviour. Or am I missing something? –  Vernade Aug 31 '10 at 13:47
add comment

Your Answer


