web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

setFocus issue

(0) ShareShare
ReportReport
Posted on by 115

Hello,

We have a problem with setFocus on our Dynamics 365 Version 1612 (8.2.1.176).

When I set focus on General tab - it should be on top of the screen but after a second the focus is set to a subgrid above the general tab. I do not have any other setFocus functions and I observed that the height of window is changed in this function:

MicrosoftAjax.js

Function.createDelegate = function(a,b)
{
   return function()
   {
      return b.apply(a,arguments)
   }
};


Do you have any idea why is this happening and how to prevent the window to scroll up after I have set the focus to a tab? 

*This post is locked for comments

I have the same question (0)
  • PranavShroti Profile Picture
    4,510 on at

    Hi ddelic,

    This could be because of tab order of fields. The default tabbing order on CRM forms is top to bottom, left to right.

    you can write a small script to set the order:

    function SetTabOrderForFields() {

    for (var i = 0; i < Xrm.Page.ui.controls.getLength() ; i++)

    {

      var control = Xrm.Page.ui.controls.get(i);

      var element = document.getElementById(control.getName());

      if (element.tabIndex && element.tabIndex != "0") {

          if (element.className == 'ms-crm-Hidden-NoBehavior')

              continue;

          if (element.tagName == 'A') {

              if (element.className != 'ms-crm-InlineTabHeaderText')

                  continue;

          }

          element.tabIndex = 1000 + (i * 10);

      }

    }

    Hope this helps.

    Regards,

    Pranav

  • Nausher Sayeed Profile Picture
    522 on at

    Hi,

    The supported way is that to put the fields in sections of 1 row. Tab will going from up to down it goes to left to right.

  • deno43 Profile Picture
    115 on at

    I don't think you understood my problem. I have a piece of code that says Xrm.Page.ui.tabs.get('general').setFocus(); and suddenly after, the window scrolls up for no reason. This has nothing to to with tab on the keyboard...

  • deno43 Profile Picture
    115 on at

    So after I set focus to a tab Xrm.Page.ui.tabs.get('general').setFocus(); - for a moment I can see "General tab" name and the fields in the tab on the top of the window, and after a second the window scrolls up and the "General tab" is located in the middle of the window which I do not want to beacuse I have set the focus earlier...

  • Verified answer
    PranavShroti Profile Picture
    4,510 on at

    well this could be because of field order thats what I suspected. Anyways.

    I am not sure of the reason however as a workaround you can hide all other tabs and just make general tab visible and set focus. Check if that works.

    Regards,

    Pranav

  • deno43 Profile Picture
    115 on at

    Yes, nice thinking. This solved the problem we had, the focus stayed on general tab when I collapsed the tab that contained subgrids. Subgrids definitely are a problem here, will need to investigate this further.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans