SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a dropdown lookup field in newform.aspx form. Unlike choice dropdown the lookup dropdown is input field and not select

So I raise an onchange event using jWuery

$(document).ready(function() {

Since sharepoint refers a lookup dropdown as a input field rather than select, if the index changes based on the values in the drop down box the change event does not fire.

But if I type in anything in the lookup dropdown box the event fires. What I'm looking for is to fire the event when the values from the dropdown are selected. Any suggestions?

share|improve this question
up vote 4 down vote accepted

First of all some notes about this (weired?) sharepoint behavior (when html select renders as input). If you have a lookup field in your new\edit forms, this lookup may renders differently depending on browser and (wow!) items count in lookup list. When in lookup list items count less than 20, than all ok, in every browser lookup field renders as html select:enter image description here
On the image above it is an ie and lookitup refers to a list with 19 items. When we added one more item in lookup list situation is changed:enter image description here
and in ie only, all other browsers render lookitup as select. This is actually input with image, with number of event attached to provide suggest/filtering. This suggest/filtering feature works only in ie.
Ok, how to capture change event. @James Montagne recently asked this question. SharePoint 2010 has a js function called _SetCtrlFromOpt. This function fires on new\edit forms every time when value of "suggested" input is changed. You can catch it by substitute with custom function:

      var oldset = _SetCtrlFromOpt;
      _SetCtrlFromOpt = function(ctrl, opt){
            oldset(ctrl, opt);

You need to add this js code to your new\edit form. Here ctrl is a DOM input element, and opt is an element that represents suggestion dropdown. opt.options[opt.selectedIndex].value returns lookup id of a selected item in source lookup list, and opt.options[opt.selectedIndex].text returns lookup value.

Note: _SetCtrlFromOpt handles all lookup fields on the new\edit form, so if you have more than one lookup on your forms, and if you want perform some action only on the one of them, you need to filter all others events, that will be fired.

share|improve this answer
Thanks kai it works!!!...but the alert pops twice once when i open the drop down and i have to double click on the option to select(once)..and then when the selected option enters inside the dropdownfield(twice)...can we restrict it to jus pop up once..Thanks again! – spStacker Feb 2 '12 at 21:59
Try to remove alert line, it seems that pop up with alert fire lose focus event, which fire _SetCtrlFromOpt again :). After removing alert all should work as expected. – Kai Feb 3 '12 at 9:04
yes it is working out, Thanks Kai! – spStacker Feb 3 '12 at 16:12

Dropdown lookupcoloumn in sharepoint forms may have some issue like this here is the way that I solved it:

var choices = $('[title="Title"]').attr("choices");     
var choiceArray = choices.split("|");
for(var i=0;i<choiceArray.length;i++){
if(choiceArray[i]==291){ // 291 is the LookupId of that LookupValue
console.log(choiceArray[i-1]); // The Lookupvalue that you required     


share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.