Friday, June 13, 2008

Dynamically changing the name of a tab

This comes from one of my coworkers, great hack. This works not only in the onLoad but also on the onChange of any field on the form. This is a great, simple script that might help users out a bit more.

Code:
var title = crmForm.all.primarycontactid.DataValue;

if(title != null)
{
document.all.tab4Tab.innerText = title[0].name;
}


You will need to change your tab4Tab to whatever tab you have on the form (remember, tabs start at 0 for the first position so make sure you get your numbering correct).

Simple as that. Now your tab will show the text of the name of the Primary Contact. Oh, one stipulation, the size of the tab will not regrow using this code, only the text. So, if your tab is named "Test" and I were to replace it with "David Fronk" then my name would get "wordwrapped" and it could look pretty funny. So, make your initial name something longer. If I come across how to dynamically grow the tab so as to fit the name being placed in it I'll definitely post that up here as well.

Enjoy!

David Fronk
Dynamic Methods Inc.

2 comments:

Unknown said...

Hi David

I am new to CRM 4.0 and just spending time importing records, etc. I was wondering is there any way to modify the quick find lookups? For example, on the Contracts quick find field, it goes by contract number. Could this be modified to search on another field? I can't seem to locate this.
thanks

Dynamic Methods said...

Mark,

You absolutely can. You need to modify the "Find" fields within the Lookup View of the Contract. Here's a post I did on this awhile back, check it out, I think it's what you're looking for.

http://dmcrm.blogspot.com/2006/03/power-of-editing-quick-find-and-lookup.html

David Fronk
Dynamic Methods Inc.

Post a Comment