Skip to main content
Question

HTML widget JS: activate

  • March 2, 2026
  • 3 replies
  • 17 views

Iain Sharp
Forum|alt.badge.img+5

I have a CS form with an HTML widget on it. 

The CS form has a proc on it as per below. 

entry lp_refresh
$fieldhandle("d_to_do_list")->$widgetoperation("JS:uniface.getInstance('SYD_TO_DO_LIST').activate('refresh')")
end

The DSP SYD_TO_DO_LIST has an operation refresh as per below. Where “widget” is the name of a DSP container widget. 

operation refresh
public web

scope
input
output
operation all_instances().refresh
endscope

if(widget != "" & widget != "SYD_BI")
activate widget.refresh()
endif


return 0
end

This successfully executes the refresh operation on the DSP contained by the widget container, and in turn on a widget contained by that container. So it all appears good. 

However, if I inspect the cef process (ENABLEDEVTOOLS=true), it builds up uncaught exceptions as per below, every time the refresh is fired. NOTE the refresh works, it just stacks an error in the dev tools. 

 

VM124:1 Uncaught TypeError: uniface.getInstance(...).activate(...) is not a function at <anonymous>:1:58

with the details given when expanding this as:-

uniface.getInstance('SYD_TO_DO_LIST').activate('refresh')();

So where does the extra () come from? There are no parameters to any refresh operation on any of the contained DSPs. 

 

3 replies

Michael Taylor
Forum|alt.badge.img+2

Taking a quick peak at the documentation for $widgetoperation it shows

$fieldhandle -> $widgetoperation ( WidgetOperation {, Params})

So I would try

$fieldhandle("d_to_do_list")->$widgetoperation("JS:uniface.getInstance('SYD_TO_DO_LIST').activate”, “refresh”)

 


Iain Sharp
Forum|alt.badge.img+5
  • Author
  • Inspiring
  • March 2, 2026

I’ll give it a go. 

Iain

 


Iain Sharp
Forum|alt.badge.img+5
  • Author
  • Inspiring
  • March 2, 2026

Yeah, that’s made the issue go away. I need to look at what happens when the operation to be activated does need parameters, but that’s not the case here.