SharePoint 2003: How choice / lookup options are populated

In SharePoint 2003, the way fields are rendered is determined by RenderPatterns in the FLDTYPES.XML file. Render patterns are xml specifications for how a field should be rendered. Most field types (e.g. text, dates etc) don’t need to be pre-populated with any information, however some do, such as a choice field or lookup field. Below are some rough notes on how options are populated:

Choice values are populated in a choice control by the ows.js file (fields.xml defines where values for the select options are to be passed through). These are actually rendered at runtime using JavaScript (surprisingly).

Lookup options appear to be populated via the SelectOptions element in the renderpattern. From what Ive looked into, it appears that you cannot manipulate SelectOptions (e.g. there are no attributes for filtering etc). See http://www.sharepointu.com/forums/Lookup_Field_with_a_Query/m_3802/tm.htm

Due to the nature of the renderpatterns, it looks like you cannot construct your own options via a CAML queries (i.e. when creating a custom field type, or altering an existing field type). There are certainly no examples of this in FLDTYPES.XML. Even if you could, I am not sure how you would get the results of the CAML query into an array an iterate over it. I guess its not possible.

The only way around this that I can think of is to use JavaScript to clear and then repopulate the options of a select box (maybe obtaining the new options via an ajax webservices call).

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>