Omnis Technical Note TNJS0006April 2016
for Omnis Studio 6.0 or above
By Jason Gissing, Omnis Engineering
We suggest that Chrome has the best developer tools, and it is cross-platform, so is what we use in this tech note. The same principles apply to other browsers and their dev tools though.
- Open your remote form in Chrome.
- Open the Chrome Dev Tools (Shortcut key is Ctrl-Shift-i or Cmd-Alt-i).
If the dev tools open inside your main Chrome window, you may like to undock it to a separate window, to give you more space.
- Open the menu (3 dots) at the top-right of the Dev Tools window, and change the Dock Side option.
- Select the Sources tab.
- View the Sources in the navigator sidebar:
There will be a .js file within this for each form containing the client methods.
- Select the .js file corresponding to your form (it will be named as your form, with random numbers appended).
- Scroll through the .js file’s contents in the main window to find the method you wish to debug.
It will be named using the format: omn_form.prototype.<Library Name>_<formName>_<Method Name>_<Number>
- Click the line number next to a line to add a breakpoint.
- Now cause your method to be called - it should hit your breakpoint.
- Mouse over a variable to view its value.
The Debugger sidebar on the right of the window contains buttons at the top to step through the code etc. It also contains a Call Stack so you can see the stack trace that led to this point.
Prettify Minified Code:
Break On Exceptions:
If your code is causing an exception (you will generally see something added to the Dev tools Console, or an Omnis error dialog may be shown on the client, if this occurs), you can tell the debugger to automatically stop on the exception.
- Open the Sources tab of the dev tools.
- Click the ‘pause’ icon at the top of the debugger sidebar on the right, and enable Pause on Caught Exceptions.
When the page first loads you may hit two exceptions inside jQuery - these are fine to ignore, as jQuery is catching and handling these.