.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Mission Impossible? Use Javascript to Disable a Multi-Line Rich Text Field

Posted By:      Posted Date: August 26, 2010    Points: 0   Category :SharePoint

Hey Community,

Here's a tough one that I have struggled with and so far have not been able to find an answer for - how do you use Javascript to disable a multi-line rich text field.  I have customized a SP Edit form by adding a CEWP.  In the CEWP I have added the Javascript below (only a partial code sample provided) to disable several fields in the form.  The code works fine for single line text fields but it does not work for multi-line rich text fields.  Any suggestions?

<script language="javascript">
//This runs the function when the form first loads

//This locks the fields the users should not modify
function lockFields()
  var theInputTFTitle = getTagFromIdentifierAndTitle("Input","TextField","Title");
  theInputTFTitle.readOnly = true;
  theInputTFTitle.style.color = 'gray';
  //alert(" Value: " + theInputTFTitle.value);//for testing

   var theInputDDLReplyStatus = getTagFromIdentifierAndTitle("select","DropDownChoice","Reply Status");
  theInputDDLReplyStatus.disabled = true;
  //alert(" Value: " + theInputDDLReplyStatus.value);//for testing

  var theInpu

View Complete Post

More Related Resource Links

Multi-Line, Rich Text Field anomaly


When a user clicks on Edit Item for a previously populated and saved List item in SharePoint Services 3.0, the "edit item page" appears but the rich-text multi-line field is blank ... until it is right clicked on in the white space of the multi-line field, then the content that had been previously saved appears.

Should the user fail to right-click in the white space of the multi-line field before saving the List item again, the content previously saved will be saved over as blank. Only recoverable by version control (if enabled for that List).Not tested on

Office XP or Internet Explorer v6.

Office Pro 2007
Internet Explorer v8
Windows XP SP3
SharePoint Services 3.0 SP2 CUAug2010

Column Setting:
Append Changes to Existing Text = NO (default)
Specify the type of text to allow = Rich Text

I was able to reproduce the issue on different desktops with different List items on different Sites for both MOSS 2007 and WSS 3.0.  Clearing the browser cache doesnt resolve it.  I've proven it to

Javascript error on Rich Text Editor of CEWP

Hi all,

I have a problem that is really bugging and I wasn't able to find any workaround all day. I'll try to give as many details as possible:

I'm maintaining several site collections on a single server and this problem occurs only on one of the site collections. However it occurs on all subsites of this collection, it occurs on old pages and newly created pages, even on pages containing only one empty CEWP.

When I'm pressing the button for Rich Text Editor of CEWP I get the following error:

Message: Invalid argument.
Line: 5740
Char: 2
Code: 0
URI: http://www.dyrlaegeankenaevn.dk/_layouts/1030/HtmlEditor.js

I've tracked down the error with IE developer tools and I found that the error pops up in HtmlEditor.js at

function RTE2_GenerateLaunchArguments(parameterArray, webUrl, containerID)
    ............some code goes here......................
    ............some code goes here......................

I followed containerID down the stack and it comes from:

Rich text field showing html code

I am an end user of Sharepoint. This issue only happens from my computer, not from any other within our organization. What happens is that when I edit an item in Sharepoint that contains a rich text field, HTML code is showing. Like so: <div class=ExternalClassC900CFF4F2BF4312A89133C01A6E3C96> Some text</div> This happens from any web browser. Sharepoint 2007 is used. I have Windows 7 x64. Any idea what is causing this?

SharePoint 2010 Rich Text Editor field

I want to embed iframe tag in Sharepoint 2010 rich html text editor control, but it is simply remove the tags when i save the content. Please let me know how can i do this?

Display each new line of a sharepoint mutliline text field as choice in drop down box.

The question pretty much says it all. I have a lot of data I need to represent, and this would be the best way to do it. I have a multiline text field in sharepoint, where each line has a choice that should be a seperate choice in a text box. How do I do this? I have the data connection set up, and I would be fine with adding some sort of tag after each line, if that would make it so infopath can somehow parse out those tags, and interpret each "chunk" as a choice. Thanks in advance for your help.

Infopath browser form - odd behaviour on auto expanding multi line text boxes




I have a browser form with a multi line text box. The height is set to be AUTO. Within the client all is fine. When opened as an administrator approved form the text box automatically adds a new line for every 20 characters you type.


So if you type 40 characters without pressing enter you get 2 blank lines appear under you text that you CANNOT remove.


I have tested this on a new form with various multi line text boxes. The width setting is unimportant, the spell check setting is unimportant.


If i fix the height then the issue goes away but this is not any good.


I cannot use rich text boxes as i have around 40 text boxes on the form and if they are rich text they take around 10 minutes to load in the browser (this is another issue i have)


Thanks in advance



Rich text editor for Title field in Publishing site


I have one French publishing site. I want to set one page title like this: see BOTOX trademark here . To show title like this i need to put tag like Product <sup>MC</sup> . Problem is, if i put above tags in title text box at the time of page creation then page title showing Product <sup>MC</sup> not  like above site.


Regards, Sandip Patil, .Net,Sharepoint Developer www.worldofsharepoint.com

Page layout - Custom Multi line field limits at 255 chars



Hi group,


I hope i use the correct terms since I have a DUTCH :-( Sharepoint version.


I created a new Site Content Type, called activity.

I added a new column (Add from new site column)

The type of this column is: Multiple lines of text.

(I choose this because single line of text can contain up to 255 chars)


In Microsoft Office Sharepoint Designer (MOSD) I created a new pagelayout (File => new => Sharepoint Content => pagelayout)

and inserted the field activity to the .aspx page.

<SharePointWebControls:NoteField FieldName="Comments" runat="server"></SharePointWebControls:NoteField>

Why is the fieldname Comments I expected Activity?


I then created a new page (in MOSS) based on the created pagelayout.


Works like a charm.

Problem: I cannot add more than 255 chars to the field activity although it is a multiline type.

Does anybody

Form Services 2010 - potential bug in plain text - multi-line boxes



Just wondering if anyone else has found the following and perhaps a resolution.  (Blog post with image examples here: Click)


An InfoPath Form created in Microsoft InfoPath Designer 2010 and is installed as an Administrator approved template.

  • Form Control: Text Box


  • Read-only – No
  • Enable spelling checker – Yes
  • Enable AutoComplete – Yes
  • Multi-line – Yes


  • Height: Auto

Compatibility Settings:

  • Form Type: Web Browser Form (2010)


  • Browser: Internet Explorer 7, 8, Google Chrome

When running the Form in the web and a user types into the multi-line text box; after 20 characters the text box gets bigger by 1 row.

On evaluation using the IE8 development toolbar.  It would appear that the control is rendered as a <textarea> HTML element and JavaScript runs on the 22<sup>nd</sup> character and adds 1 to the “rows” attribute of the <textarea> element.

For example:

InfoPath Form and Multi-line Text box


I'm using a multi-line textbox in my infopath form, the text scorlls when user enter texts that exceed the width/height of the text box, thats fine. But after user submits the form, the textbox just dsiplays one line of text with with "..." at the end and user needs to use "End" key or drag the text using the mouse key to see the remaining text. We want to display all the text that user entered instead of "...". What setting needs to be done in the inforpath forms.

Also I wanted to know if there is any known issue using Rich Text field in Infopath form with SharePoint InfoPath service.

Thanks in advace,

Displaying data from Enhanced Rich Text field


Iam using a custom list, one of the column datatype of the list is Multiple lines of text with type of text to allow as Enhanced Rich Text. Users in my site can copy any type of data and paste in that list coulmn. I need to display the list data in a webpart same as how it is copied. But after querying the list iam getting all the Style tags. How to avoid this.

For example, i copied the following text in the coulmn as below:

One advantage of using the SPGridView control in SharePoint-based solutions is that it has been integrated with the cascading style sheets that are built into Windows SharePoint Services 3.0. Also, the SPGridView control is heavily.
But after quering the list while displaying, following is the output iam getting. How to avoid the tags:

<div class=ExternalClass70B2A73EC47547F98E72395A66BC565C><div>One advantage of using the <strong>SPGridView</strong> control in SharePoint-based solutions is that it has been integrated with the cascading style sheets that are built into Windows SharePoint Services 3.0. Also, the <strong>SPGridView</strong> control is heavily </div></div>

How to save formatting from a multi-line text box into SQL 2005


Hi Everyone,

I have a web form that has a few multi-line text box controls which the user will enter lots of information in paragraphs.  How can I persist their line breaks and tabs into SQL 2005 so that when the information is retrieved on a different page; the line breaks and formatting is preserved?

Thank you!


Changing a Text field to a Rich Text field


Is it possible to change an existing field from a text field to a rich text field?  I see options to change it to an option button, date picker, but rich text isn't available. 

If it's not possible to change the field can a new rich text field be linked to show the info from a previous field?  I created a form for a pilot group and based on feedback want to change fields from text to rich text without losing the information from the previous forms.

Rich text field error in web-form



I have a few rich text fields in a browser enabled infopath 2010 form. When I tried to submit it an error apppeared.

Retrieving the COM class factory for component with CLSID {52F5D46F-CBEA-4D07-BCB7-7296853F0CF2} failed due to the following error: 80040154. System.Runtime.InteropServices.COMException (0x80040154): Retrieving the COM class factory for component with CLSID {52F5D46F-CBEA-4D07-BCB7-7296853F0CF2} failed due to the following error: 80040154.
at Microsoft.Office.InfoPath.Server.DocumentLifetime.EventRichTextChange.HtmlToCleanXHtml(String html, Boolean makeDomCompatible)


I deleted all rich text fields the form was submitted successfully.

Is this a bug of Infopath 2010? Is any ways to use rich text fields?


Best Regards,



How to put a filter on a list based on the latest update on one particular multi-line text format co


Hi All,

In one of my lists, I have a column with multi-line text format that Appends Changes to Existing Text. I need to create a view that showes the 5 entity of this list whcih in those, my multi-text column is being modified most recently.

My first attempt was to create another column in the list with calculated format and use the formula section to modify it somehow to meet my goal, however as my desired column has multi-line text format, it seemd imposible.

By the way I am using Wss.3.




Insert "

" at each line break in a rich text box c# 2010


I want to type a letter in a rich text box and have it converted to html format for bulk email send to customers. Ideally I want to add "</p><p> at each line break, but right now i'd be happy to simply replace the line breaks.

When i run the text through

Int32 n = 0;

string s = EmailBodyRichTextBox.Text;

string t = "";

foreach (char c in s)

Change data type of library field from Single Line Text to currency


I have an InfoPath 2010 form that has a field listing the amount of currency on a meter. It is a Decimal form in Infopath but publishes to SharePoint as a Single Line of Text.  It will not let me modify the column in SharePoint and it will not let me select the allow edit from the Publishing Wizard.  I need the column as a currency so my Excel Queries work.



ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend