how to expand a text field in order to remove scro

2019-08-11 01:47发布

I deal with dynamics CRM 2011 online and I faced some troubles with printing documents there.

If there is a scroll into a form so in print window it'll too and I can't do anything with that coz there is any editing function there.

I'm interested could I resize/expand a text field in order to make a text visible for user without any scrolling?

Is there any method in JavaScript that can remove scroll by resizing field?

In dynamics CRM I may use such functios on an onload event.

thanks in advance

tried

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

got an error:

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

3条回答
Fickle 薄情
2楼-- · 2019-08-11 02:25

You can do this in a supported fashion if you wish to embed a web resource into your CRM 2011/2013/2015 form. You will have to look at the CRM SDK for how to retrieve the field's values from the form in JavaScript, and then use that to create a textbox using jQuery as Rajnikant mentioned. When you're doing it in a web resource, you are not constrained to using the Xrm.Page model and you can use normal JavaScript.

For help with crafting the query to get your field(s) data into the web resource, use this tool to simplify things: https://crmrestbuilder.codeplex.com/

查看更多
等我变得足够好
3楼-- · 2019-08-11 02:30

Not in a supported fashion.

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.

And as far as I know Xrm.Page.ui doesn't support that kind of functionality.

查看更多
够拽才男人
4楼-- · 2019-08-11 02:43
You should use below jquery plugin to auto expand textarea.

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

查看更多
登录 后发表回答