title: How to set a control's DataValue to a number in MS Dyanamics CRM 4.0?
body: <p>I need to set the value of a field in a form via JavaScript. The source of the data is from another source, via an IFRAME.  I'm running this code in the onload of the ASPX page in the IFRAME:</p>
  
  <pre><code>// Get value from source
  var currencyText = document.getElementById("contractValue").value;
  
  // Convert that value to a number, stripping out non-number characters.
  var currencyNumber = new Number(currencyText.replace(/[^0-9\.]+/g,""));
  
  //  Set the value in the CRM field.
  parent.crmForm.all.targetCurrencyField.DataValue = currencyNumber;
  </code></pre>
  
  <p>When I do this I get an message "This control only accepts numbers or null as input".  What is the acceptable way to load a value into a currency field in MS CRM? </p>