Tuesday, September 8, 2009

CRM 4.0 Changing Tab Order

A while back i posted a solution for changing vertical tabbing to horizontal tabbing. The code ran a bit slow with lookups and so the code below is a revision of the previous posting with the fix.


function OnCrmPageLoad()
{
ReArangeTabIndex();
}

function ReArangeTabIndex()
{
for( var i = 0 ; i < crmForm.all.length ; i++ )
{
var element = crmForm.all[ i ];
if (element.tabIndex)
{
if (element.className == "ms-crm-Hidden-NoBehavior" || element.tagName == "A")
{
continue;
}

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

OnCrmPageLoad();

8 comments:

Shai said...

Can you supply a link to your post about changing vertical tabbing to Horizontal . I can find it on your blog.

Adi Katz said...

Here is the link to the previous post Handling CRM Tabs

Rahul said...

i used the above the code , but the it works in some places and breaks at other and keeps jumping fields in between.

Adi Katz said...

Different form layouts might require further tweeking. Does it jump certain field types or is it random?

Rahul said...

actually it works properly in the general tab but breaks randomly, but when i move to a new tab , there it does not apply only, it goes to the first field and then breaks completely and moves to the save and save and close buttons above.
i can see a pattern in the new tabs , but in the general tab it breaks randomly.
also moving from one section to another breaks the rhythm sometimes.

vermin said...

Hello everybody!

It works great, but would it be possible to avoid the tab move to the fields in the forms assistant?

Thank you!!

George Nixon said...

Thanks for the code! I've adapted it to remove the Form Assistant from the tab ordering as well with these two lines:

document.getElementById("ContextSelect").tabIndex = -1;
document.getElementById("RelatedInformationPane").tabIndex = -1;

As usual with Javascript, it only took two lines to achieve what I wanted, but an hour of debugging to figure it out! Hope this saves someone the anguish :) George

Anonymous said...

Works perfectly, thanks!