Activates a widget operation of the references widget.
|WidgetOperation||String||Literal string or variable containing the
name of a widget operation that is available on the specified widget.
For supported widget operations, consult the documentation of the specified widget. See Applies To.
|Params||String||Comma-delimited string of operation parameters for the specified function.|
||An incorrect field name was provided; either the field name is not valid syntactically or the field is not available in the component.|
||Parameter is not valid, for example, an empty string ("")|
||The operation name provided is not valid.|
||Wrong number of parameters|
||Field is not visible|
||Widget operation not valid|
Use in Form components.
Widget operations are predefined, widget-specific functions that enable you to address the widget content independently of the field value. For most widgets, the value displayed by the widget is the same as the field value; they are tightly coupled. However, some widgets do not necessarily display the actual field value. For example:
- The Output Box may contain information that has not been synchronized with the field value, or vice versa.
Widget operations make it possible to manipulate the widget content directly, without interference of the field.
To call a widget operation, you must activate the $widgetoperation function on a field handle (obtained with $fieldhandle).
The $fieldhandle function returns the handle of the widget that is bound, at that moment, to the specified field of the current occurrence. The function $widgetoperation works only on the widget, even if the widget has subsequently been bound to a field of some other occurrence. Any actions done on the widget affect the widget primarily. Depending on the type of widget, the widget may influence the field value or field properties.
By definition, a widget is always in view, so scrolling through multiple occurrences causes a different field to be bound to the widget as the data is scrolled. Calling $widgetoperation on a field that is not visible (for example, scrolled out of view), results in an error and the widget operation is not performed.
Note: For this reason, $widgetoperation should not be used if you want to change the displayed content based on the occurrence being displayed.
If you want the widget to display different content in each occurrence, you should change the value of the field rather than using widget operations. Alternatively, you could use the Form Container widget to embed a form that contains the widget and use $widgetoperation to manipulate the content of the contained instance.
For more information, see $fieldhandle and Effect of Widget Operations in Multi-Occurrence Lists .
;vHTMLText is a string variable containing the HTML to be displayed $fieldhandle(FIELD1)->$widgetoperation("loadHTML", vHTMLText) ;vAlertText is a string variable containing the text to be displayed in the alert box $fieldhandle(FIELD1)->$widgetoperation("JS:alert", vAlertText)