Select to view content in your preferred language

How to dynamically change dojo element values?

7643
2
Jump to solution
11-04-2016 07:24 AM
ShaningYu
Honored Contributor

For the items in the Search.html, e.g. the 2 listed below:

                <label data-dojo-attach-point="labelSearchTerm0"> </label>
                <input type="text" style="width:100%;" data-dojo-type="dijit/form/TextBox" data-dojo-attach-point="inputSearchTerm0" data-dojo-props="trim:true,disabled:true" />

I want to dynamically re-set their values in JavaScript.  How to do it?  Appreciate if you can help

0 Kudos
1 Solution

Accepted Solutions
TimMcGee1
Frequent Contributor

Assuming your JavaScript code is in Search.js and you want to set the value in dijit you referenced with the attach point 'data-dojo-attach-point="inputSearchTerm0"`, you would use:

this.inputSearchTerm0.set('value', 'My Value');

There are numerous additional examples of this method in Search.js. Here's one: cmv-widgets/Search.js at master · tmcgee/cmv-widgets · GitHub 

View solution in original post

2 Replies
TimMcGee1
Frequent Contributor

Assuming your JavaScript code is in Search.js and you want to set the value in dijit you referenced with the attach point 'data-dojo-attach-point="inputSearchTerm0"`, you would use:

this.inputSearchTerm0.set('value', 'My Value');

There are numerous additional examples of this method in Search.js. Here's one: cmv-widgets/Search.js at master · tmcgee/cmv-widgets · GitHub 

ShaningYu
Honored Contributor

Thanks.  I got the same answer as you provided as I reviewed the code.

0 Kudos