Hey guys,
I'm using MS CRM 4 in IE8.
On the Order Product form, I am attempting to use the OnChanged event of the Quantity field do give some feedback to the user based on the current value of the Product lookup field.
My problem is that no matter what I do, the DataValue property of the field is always null.
Here's the javascript I'm testing with:
if (crmForm.all.productid_d.DataValue == null)
alert('DataValue is null');
else
{
alert ('DataValue is non-null');
alert('Length: ' + crmForm.all.productid_d.DataValue.Length);
}
Note that I've checked that crmForm.all.productid_d is definitely non-null, and that it contains the values I'm interested. From the IE8 developer window:
<td id="productid_id">
<table width="100%" class="ms-crm-Lookup" style="table-layout: fixed;" cellSpacing="0" cellPadding="0">
<tbody>
<tr>
<td>
<div tabIndex="1011" class="ms-crm-Lookup " style="width: 100%;" ime-mode="auto">
<span class="ms-crm-Lookup-Item" contentEditable="false" onclick="openlui()" otypename="product" otype="1024" oid="{DA770EAE-A4FB-DD11-BBD6-001A646872CF}" data="" ?="">
<img class="ms-crm-Lookup-Item" alt="" src="/_imgs/ico_16_1024.gif" complete="complete" imageSrc="/_imgs/ico_16_1024.gif"/>
Text - Travel Expenses
<a tabIndex="-1" title="Travel Expenses" class="atLink" id="at{DA770EAE-A4FB-DD11-BBD6-001A646872CF}" contentEditable="false" onclick="return false;" href="javascript:onclick();" target="_self"/>
<b class="IMG_lu_htc_b"/>
In the code above, it is the 'Travel Expenses' entry that I'm interested in reading out from the Lookup field.
However - even though there is definitely a value loaded in the Lookup field, the Datavalue still returns null.
My JavaScript looks right to me based on the examples I can find, and I've comfirmed that crmForm.all.product_d exists and is not null.
Any thoughts regarding what's going on?