SharePoint Lookup field: how does it work and how to add JavaScript event handler function to it?

October 26th, 2009 | Categories: JavaScript, SharePoint, SharePoint Lookup field

Due to a lot of comments and questions to my last year’s post about Attaching functions to SharePoint form fields concerning especially lookup fields on which the demo was made, I’ve decided to take a deeper dive into SharePoint’s Lookup Field and how to manipulate it client-side, since it behaves different in different situations. On the image below you can see two lookup fields – rendered different.

image

Even though new SharePoint is about to go public beta I’ll still show how to handle this in SharePoint 3.0 or 2007


How does it work?

Before explaining how to attach a functon or event handler to a SharePoint lookup field let’s take a look on how SharePoint lookup field is rendered in HTML and which is its behavior – considering client-side.

Lookup to a list with less than 20 items:

If your lookup field is reading from a list that has 19 or less items, the lookup field is rendered like a normal HTML dropdown field (HTML Logging In...

Profile

TOP