I have a custom widget and I want to update the value of a Text Field widget. How can I update values in another widget?
I got the editor:
vui.ui.editor.find(editorId);
But I can't seem to get the other widget reference. Any tips?
Try this:
////////////////////////////////////////////////////////
/**
* @function - getWidgetFieldX return widget object
* @param - editorId: The id of the current editor. When the editor is opened to edit an existing object, this id is always equal to the vcm id of the object.
* @param - wgtXmlName: widget xml name or <relator>.<widgetXMLName>
* @desc Returns the registered widget field with the given wgtXmlName, if found.
* @public
*/
function getWidgetFieldX(editorId,wgtXmlName){
var wgtObj = "undefined";
var contentEditor = vui.ui.editor.find(editorId);
if(typeof contentEditor.widgets["."+contentEditor.typeXmlName+"."+wgtXmlName] != "undefined"){
wgtObj = vExt.getCmp(contentEditor.widgets["."+contentEditor.typeXmlName+"."+wgtXmlName].fieldId);
}
return wgtObj;
var myWidgetObj = getWidgetFieldX(editorId,'attributeXMLName');
myWidgetObj.setValue('Its working !! ');
Regards,
Trilochan