Set Focus using JavaScript in CRM

Hi,

Today I was working on validating some fields on the form and showing a message to the user to enter the data.

Normally whenever we do the validation, its always better to set the focus to the required field you are pointing out instead giving the pain to the user to search for it.

Here is the JavaScript code to set the focus to the field.

Xrm.Page.ui.controls.get(“AttributeName”).setFocus();


Happy CRM’ing

Gopinath

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s