CRM 2015 – How to set focus in Javascript

I wanted to set focus in Javascript after a user had changed a field to yes, this triggered an onchange event.  The onChange event set a new tab to be visible.

The new tab was below and the users didn’t always know it was there, so I wanted to nudge them in the right direction by setting focus on the tab.

Microsoft has added a great framework for manipulating the controls.  The Javascript for setting focus works on the Control level



This blog post has a great page, it highlights the functionality available in the CRM SDK, displaying the logical structure of the JavaScript wrapper created for development

Microsoft Dynamics CRM 2013: Client API Enhancement


Different Versions

It’s important to check the CRM SDK XRM documentation because each release of CRM adds and removes functions.

Xrm.Page.ui control (client-side reference)

The CRM SDK documentation shows the functionality available for each release by selecting the CRM version in the drop down at the top of the page.

Javascript versions

When you select a different version it will change the methods available.  This enables you to see what functionality is available for each version and what new functionality has been added.