问题
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
回答1:
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.
回答2:
You should use below jquery plugin to auto expand textarea.
http://bgrins.github.com/ExpandingTextareas/
回答3:
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/
来源:https://stackoverflow.com/questions/15742740/how-to-expand-a-text-field-in-order-to-remove-scrolling-by-using-javascript