« Intranets: Ten Best Intranets of 2006 (via Jakob Nielsen) | Main | What do SharePoint, Office 12, Biztalk, VS2005 Addins and Xbox have in common? »
Great tip from Dustin Miller
I mention in just about every Bootcamp that the biggest problem with calculated fields is that you can't use them in lookups. Well, the solution, as I mention in class, is to perform your calculations on the client-side. What I don't mention in class (it's a “SuperGeek Moment”, so it's meant to get the gears turning) is the actual code. Thus I have decided that I'm going to try and write a weekly “SuperGeek Tip”. This week's tip: Calculating “Full Name” using client-side script, so SharePoint is blissfully unaware that Full Name is anything but a plain text field.
At the bottom of the NewForm.aspx and EditForm.aspx for any default Contacts list, just above the closing
element, add this code (inside a script block of course)
var lastName = document.getElementById("urn:schemas-microsoft-com:office:office#Title")
var firstName = document.getElementById("urn:schemas-microsoft-com:office:office#FirstName");
var fullName = document.getElementById("urn:schemas-microsoft-com:office:office#FullName");
lastName.onchange = fixFullName;
firstName.onchange = fixFullName;
function fixFullName() {
fullName.value = firstName.value + " " + lastName.value;
}
You can do this in FrontPage 2003, or you could modify the list definition files yourself (the so-called “Ghosted” template -- be aware, Microsoft doesn't support you touching those files if you've already deployed sites based on that site definition).
Once you've done this, adding contacts / editing contacts will both cause Full Name to calculate whenever the values of First Name or Last Name change.
-- Nice Tip Dustin!
TrackBack URL for this entry:
http://www.graphicalwonder.com/cgi-bin/mt-tb.cgi/288
Thanks, Shane, for the plug. :)
| Sun | Mon | Tue | Wed | Thu | Fri | Sat |
|---|---|---|---|---|---|---|
| 1 | ||||||
| 2 | 3 | 4 | 5 | 6 | 7 | 8 |
| 9 | 10 | 11 | 12 | 13 | 14 | 15 |
| 16 | 17 | 18 | 19 | 20 | 21 | 22 |
| 23 | 24 | 25 | 26 | 27 | 28 | 29 |
| 30 |