Thursday, December 22, 2011

SetFocus on MS CRM 2011 for tab, navigation and controls

there are some requirements in MS CRM , to set the focus on tab, navigation or on fields afetr doing some validations.

Set Focus for Tab
Xrm.Page.ui.tabs.get(0).setFous();

Set Focus for Navigation
Xrm.Page.ui.navigation.items.get(0).set Focus();

Set Focus for Fields (Controls)
(Xrm.Page.ui.controls.get("<attributeName")).setFocus();

but the last did not work for its onChange event.
so for that the work around is set the focus to some other field and get it back to the current field.
(Xrm.Page.ui.controls.get("<someOtherAttributeName")).setFocus();
(Xrm.Page.ui.controls.get("<currentAttributeName>")).setFocus();
Thanks,

yes.sudhanshu

No comments:

Post a Comment