Search code examples
dynamics-crm-2011crmxrm

Writing Javascript Code to support Multi-browsers


I am new to CRM 2011 Javascript,Can anyone please suggest me in writing the below lines in CRM 2011 Javascript to support multi browsers please.

In IE it is working fine but not in other browsers

crmForm.new_schemaname.DataValue = crmForm.all.schemaname.DataValue;

I tried to write like this

Xrm.Page.getAttribute("new_schemaname").getValue() = Xrm.Page.getAttribute("schemaname").getValue();

Throwing error saying Can't assign to a function result


Solution

  • You need to use the setValue function

    Xrm.Page.getAttribute("new_weightedpercentage").setValue(Xrm.Page.getAttribute("CFPoppStage").getValue());`
    

    You'll probably also want to check for null values before blindly assigning and reading values...