Raja O
Raja O

Reputation: 644

Enable checkbox while click the button in dojo

The checkbox must be checked while i click the "Accept" button.

HTML

<input id="eulacheckbox" dojoType='dijit.form.CheckBox' data-dojo-props='checked: false' />
<button class="defaultButton" dojoType="dijit.form.Button" type="submit" id="eulaAccept">Accept</button>

Dojo

dojo.connect(dijit.byId("eulaAccept"), "onClick", function(){
    dijit.byId("eulacheckbox"),set("data-dojo-props", "checked: true");
});

Upvotes: 1

Views: 627

Answers (2)

Bourbia Brahim
Bourbia Brahim

Reputation: 14702

There is the property checked in the CheckBox dijit just set it to true

registry.byId("eulaAccept").on("click",function(){
    registry.byId("eulacheckbox").set("checked",true)
});

Hee is a fiddle : Fiddle

Upvotes: 1

Gatsbill
Gatsbill

Reputation: 1790

this seems to work just fine using the dojo.attr method:

var eulaAccept = dojo.byId("eulaAccept");
var eulaCheckbox = dojo.byId("eulacheckbox");

dojo.connect(eulaAccept, "onclick", function(evt) {
    dojo.attr(eulaCheckbox, 'data-dojo-props', 'checked: true');
});

see the doc for more info: https://dojotoolkit.org/reference-guide/1.7/dojo/attr.html

Upvotes: 2

Related Questions