This project has moved. For the latest updates, please go here.

Get the ID of a lookup field

Mar 16, 2015 at 2:41 AM
It looks like GetValue() returns the text value (description) of the drop down. Is there a way to get the "value" (ID) of the selected item?
Coordinator
Mar 16, 2015 at 7:28 PM
Joe,
You are correct. If you'd like get the ID of the current selected item in the dropdown, you could use the Dropdown property.

For example:
var f = SPUtility.GetSPField('Dropdown Choice');
var index = f.Dropdown.selectedIndex;
// index is selected index of the dropdown
Thanks,
Kit