Please Note: This function currently doesn't work when you use Chrome Frame on Windows.
ReactorJSrun allows you to execute some JavaScript inside a web viewer. You might use this to update the display without completely reloading the BlackBox - for example, in the DayCalendar you can use ReactorJSRun to update the display of an appointment after changing the value of, say, the start time.
| Function ID | |
|---|---|
| Name | ReactorJSRun |
| Prototype | ReactorJSRun( webviewerObjectID ; javascript ) |
| Return value | The result of the javascript run (may be blank if the javascript doesn't return a value). |
SetVariable[ $$com.reactorize.jsrunresult ; ReactorJSRun( "WebViewerName" ; "JavascriptToRun()" ) ]
Let(
$$com.reactorize.jsrunresult = Evaluate( "ReactorJSRun( \"WebViewerName\" ; \"JavascriptToRun()\" )" ; Table::TriggerField )
;
MyBlackBox(/* The BlackBox function parameters */)
)
You can run any javascript code on any web viewer with this function, but there are a few gotchas - for example, you need to be aware that in all BlackBoxes, there is a 'setup' phase that occurs while the BlackBox is loading - usually, you won't be able to use ReactorJSRun while the BlackBox is still in this loading phase, but in most cases it shouldn't be a big problem.
Currently, we haven't got much documentation on the functions you can call with ReactorJSRun, as they are different with each BlackBox. Until we improve our documentation, you can search through the BlackBox Source code to find functions that you can call, but this will require a basic/intermediate level of understanding in JavaScript.
Beause of the way ReactorJSRun works behind the scenes, it's important that the URL (the 'Web Address' calculation) for your webviewer is unique.
When you are developing a solution as a BlackBox, this is all taken care of for you, so you don't need to worry about it.
However if you're using 'old skool' methods and just calling ReactorFeed(), you should take extra steps to make sure the URL for your webviewer is different on every record. If not, and you move to another record, calls to ReactorJSRun() may actually trigger JavaScript actions in the webviewer on a record other than the one you are currently looking at. Confusing!
You can do this by incorporating a primary key into your URL, or even just FileMaker's own internal record ID:
ReactorFeed( "MyAmazingSolution.html?" & Get( RecordID ) ; MyCodeTable::MyAmazingJSCode );
Comments