2013-04-01 49 views
0

我在線處理Dynamics CRM 2011,並且在那裏打印文檔時遇到了一些麻煩。如何擴展文本字段以通過使用javascript去除滾動

如果在打印窗口中有一個滾動窗體,它也會,我也無法做任何事情,那裏有任何編輯功能。

我很感興趣,我可以調整/擴大文本字段,以使文本可以在沒有任何滾動的情況下顯示給用戶嗎?

JavaScript中是否有任何可以通過調整大小字段來移除滾動的方法?

在動態CRM中,我可能會在onload事件中使用這些函數。

在此先感謝

試圖

function textAreaAdjust(o) { 
o.style.height = "1px"; 
o.style.height = (25+o.scrollHeight)+"px"; 
} 

得到了一個錯誤:

'style' - is null or it's not an object 
+0

是的,有:http://stackoverflow.com/questions/995168/textarea-to-resize-based-content-length,還有:[Google上有更多](https://www.google.co.uk/search?q=expand+textarea+dynamically+javascript+site% 3Astackoverflow.com&RLZ = 1C1RNNN_enGB377GB391&水溶液= F&OQ =擴大+ textarea的+動態+的JavaScript +站點%3Astackoverflow.com)。 –

+0

@大衛托馬斯試過,得到了一個我添加到我的問題的錯誤。我感到困惑了一點,因爲它不是CRM中的一種Web表單( – Leo

回答

2

不是支持的方式。

Supported Extensions for Microsoft Dynamics CRM

Form Scripting

Microsoft JScript functions that are associated through the customization tools to the available events in the form are supported. Interaction with data in the form is supported when performed using documented objects and methods available within the Xrm.Page.data object. Interaction with the form appearance and behavior is supported when performed using documented objects and methods available within the Xrm.Page.ui object. However, any direct interaction with the HTML Document Object Model (DOM) will probably not be upgradable. The structure of forms and HTML elements used in the forms could change in future releases. For more information, see Write Code for Microsoft Dynamics CRM Forms.

而且據我所知Xrm.Page.ui不支持這種功能。

+0

感謝的人,你救了我的神經)crm必須到期,如果他們不會解決這個功能) – Leo

1
You should use below jquery plugin to auto expand textarea. 

http://bgrins.github.com/ExpandingTextareas/

+0

)抱歉,我有點沮喪,我不確定在MS CRM中使用Jquery,但對於常見情況聽起來不夠。是文本字段有一個屬性(( – Leo

1

如果您希望將Web資源嵌入到您的CRM 2011/2013/2015表單中,您可以通過支持的方式進行此操作。您必須查看CRM SDK以瞭解如何從JavaScript中的表單中檢索字段的值,然後使用它作爲Rajnikant提到的使用jQuery創建文本框。當您在網絡資源中進行操作時,您不必使用Xrm.Page模型,並且可以使用普通的JavaScript。

對於各具特色的查詢來獲取你的領域(S)數據到網絡資源的幫助,用這個工具把事情簡單化:https://crmrestbuilder.codeplex.com/

相關問題