Hi Team,
Am trying to set random value for textfield in our scenario.
but it's not setting up.
<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:cq="http://www.day.com/jcr/cq/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0"
jcr:primaryType="cq:Dialog"
title="Multi Field"
xtype="dialog">
<items
jcr:primaryType="cq:Widget"
xtype="tabpanel">
<items jcr:primaryType="cq:WidgetCollection">
<tab1
jcr:primaryType="cq:Panel"
id="first"
title="Global Disclosure">
<items jcr:primaryType="cq:WidgetCollection">
<example
jcr:primaryType="cq:Widget"
hideLabel="false"
name=“./example”
id="global"
title=“Id”
xtype="multifield">
<fieldConfig
jcr:primaryType="cq:Widget"
border="true"
hideLabel="true"
layout="form"
padding="10px"
width="1000"
id="multi"
xtype="multi-field-panel">
<items jcr:primaryType="cq:WidgetCollection">
<Id
jcr:primaryType="cq:Widget"
dName=“id"
fieldLabel="Id"
width="300"
maxLength="10"
id=“id"
xtype="textfield">
<listeners jcr:primaryType="nt:unstructured"
loadcontent="function(box,value){myValue = Math.random() * 10;
value = box.findParenteByType('tabpanel').getComponent('first').getComponent('global').getComponent('multi').getComponent(‘id');
value.setValue('Set'+myValue);
}"/>
</Id>
</items>
</fieldConfig>
</example>
</items>
</tab1>
</items>
</items>
</jcr:root>
Please guild me, if i miss something in my dialog.
Thanks in advance.
Solved! Go to Solution.
Views
Replies
Total Likes
Write a custom xtype and set it using JS and available listeners in the Widget API.
http://docs.adobe.com/docs/en/cq/5-6-1/widgets-api/index.html
See this community article on how to dynamically set dialog fields:
https://helpx.adobe.com/experience-manager/using/dynamically-updating-aem-custom-xtype.html
Coding with the widget API in a JS (custom xtype) gives you much more control as opposed to trying to get a method that you define in a node property working. In an Event handler of the the custom xtype - create the random value and set it within the text field.
Views
Replies
Total Likes
Is your loadcontent listener is getting called ?. try adding a console statement and verify this.
Views
Replies
Total Likes
Write a custom xtype and set it using JS and available listeners in the Widget API.
http://docs.adobe.com/docs/en/cq/5-6-1/widgets-api/index.html
See this community article on how to dynamically set dialog fields:
https://helpx.adobe.com/experience-manager/using/dynamically-updating-aem-custom-xtype.html
Coding with the widget API in a JS (custom xtype) gives you much more control as opposed to trying to get a method that you define in a node property working. In an Event handler of the the custom xtype - create the random value and set it within the text field.
Views
Replies
Total Likes
edubey wrote...
Is your loadcontent listener is getting called ?. try adding a console statement and verify this.
loadcontent is not working, i can't see anything in console.
Views
Replies
Total Likes
Views
Likes
Replies