1

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
Leo
  • 1,787
  • 5
  • 21
  • 43
  • Yes, there is: http://stackoverflow.com/questions/995168/textarea-to-resize-based-on-content-length, also: [there's more at Google](https://www.google.co.uk/search?q=expand+textarea+dynamically+javascript+site%3Astackoverflow.com&rlz=1C1RNNN_enGB377GB391&aq=f&oq=expand+textarea+dynamically+javascript+site%3Astackoverflow.com). – David Thomas Apr 01 '13 at 11:41
  • @David Thomas tried, got an error which I've added to my question. I'm confused a bit coz it's not a web form actually in CRM ( – Leo Apr 01 '13 at 13:04

3 Answers3

2

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.

James Wood
  • 17,286
  • 4
  • 46
  • 89
1
You should use below jquery plugin to auto expand textarea.

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

Rajnikant Kakadiya
  • 2,185
  • 1
  • 23
  • 30
  • sorry, I'm a bit frustrated, I'm not sure about using Jquery in MS CRM, but for common case sounds enough. Ant the problem is that is text field there is an attribute(( – Leo Apr 01 '13 at 13:02
1

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/

P. T.
  • 329
  • 2
  • 5