Reputation: 2917
In cq dialog.xml
I have the following textfield
:
<foo
jcr:primaryType="cq:Widget"
name="./foo"
xtype="textfield"/>
In javascript, I have the following code:
function baar(){ var myString = "test";}
How to pass myString
to the cq Dialog textfield
?
Upvotes: 0
Views: 1273
Reputation: 9281
You can use the setValue()
method of the field to set the value.
function baar() {
var myString = "test";
var foo = this.findParentByType('dialog').getField('./foo');'
foo.setValue(myString);
}
Kindly refer the widget api docs for more information on the available methods. A similar SO question already answers this.
Upvotes: 1