2013-04-02 46 views
2

我已經嘗試設置參數爲:動態CRM 2011傳遞數組作爲參數

array("item1","item2","item3") 

,也可以作爲:

new array("item1","item2","item3") 

,也可以作爲:

var Labels = new array("item1","item2","item3") 

enter image description here

但我看不到m將數組傳遞給以下函數:

function BoldLabel(Labels) { 
    var length = Labels.length; 
    var element = null; 
    for (var i = 0; i < length; i++) { 
    element = Labels[i]; 
    document.getElementById(element).style.fontWeight="bolder"; 
    document.getElementById(element).style.fontSize="13px"; 
    } 
} 

我不斷收到「數組未定義」錯誤。我確信我看到這個地方完成了,但卻找不到這個例子。問題是,我希望能夠重複使用此代碼,所以只是路過我想大膽的項目組成的數組會比切削更容易和代碼粘貼到一個新的功能,並在每個標籤名稱分別寫像

document.getElementById("new_pricingsubtotal_c").style.fontWeight="bolder"; 
document.getElementById("new_pricingsubtotal_c").style.fontSize="13px"; 
document.getElementById("new_pricingsubtotal1_c").style.fontWeight="bolder"; 
document.getElementById("new_pricingsubtotal1_c").style.fontSize="13px"; 
document.getElementById("new_lineitemtotal_c").style.fontWeight="bolder"; 
document.getElementById("new_lineitemtotal_c").style.fontSize="13px"; 
document.getElementById("new_trucktotalcost_c").style.fontWeight="bolder"; 
document.getElementById("new_trucktotalcost_c").style.fontSize="13px"; 

任何幫助,將不勝感激!

+1

作爲一方,您確實知道這種定製不受支持,並且不能保證能夠跨瀏覽器或將來的CRM彙總。相關閱讀:http://stackoverflow.com/questions/15742740/how-to-expand-a-text-field-in-order-to-remove-scrolling-by-using-javascript/15761475?noredirect=1#comment22404941_15761475 –

+0

我完全理解,但微軟的這種強迫我們的手並沒有給我們通過Xrm框架來實現的方式。我們是UR12的內部部署部署,所以我們只需慢慢從我們這裏獲取更新,並確保它不會破壞任何內容。如果它確實或有能力,那麼我們將不得不改變代碼。我希望他們能夠在未來實現這一能力,然後我們修改我們的代碼並離開我們。在此之前,我們的選擇是使用oData調用等將整個表單重寫爲網絡資源,以便按照我們想要的方式進行格式化。 – JustinCredible

+1

聽起來像一個明智的態度,它只是重要的是要知道什麼樣的未來變化可能會做你現有的工作,例如你見過北極星的形式嗎?他們完全不同。 –

回答

5

你嘗試Array(而不是array)?另外,您也可以使用數組字面值來嘗試,例如:var myarray=["item1", "item2", "item3"]

+0

ahhh男人這整個腸衣這是殺了我。我對JavaScript相當陌生,但真正瞭解這個CRM開發。 – JustinCredible

+0

是......更改爲Array()做到了。所以對我來說,這個教訓是,當它說它是未定義的...我可能錯誤地命名錯誤或套管。你提供的第二個例子有什麼好處?只是好奇,因爲它看起來像陣列(「項目」,「項目」,「項目」)工作正常 – JustinCredible

+1

很高興它幫助。使用數組文字沒有特別的好處,只是提到它是幫助您調試問題的一種方式。 – udog