This is a migrated thread and some comments may be shown as answers.

Prepopulate RadEditor

5 Answers 58 Views
WebParts for SharePoint
This is a migrated thread and some comments may be shown as answers.
David
Top achievements
Rank 1
David asked on 28 Jan 2010, 08:10 AM
Hi,

I am using jQuery to prepopulate a number of fields on a new item form, with one of the fields utilising the RadEditor. I can populate the field fine, but would like to add line breaks and unsure if and how to do so. So basically I want to be able to pass in a string to the RadEditor and including some basic formatting (tabs, new lines etc)

"This is what I have now: Add description here"
 -------------------------------------
"This is wat I would like:

Add description here"


How can I achieve this?

Thanks

David

5 Answers, 1 is accepted

Sort by
0
Stanimir
Telerik team
answered on 28 Jan 2010, 08:35 AM
Hi David,
Provide me with the jQuery source, which you are using to prepopulate the RadEditor content. I will use it to reproduce the issue on our test server and give you an appropriate solution.

Regards,
Stanimir
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
David
Top achievements
Rank 1
answered on 04 Feb 2010, 04:34 AM

Below is a cutdown version of my script. The bolded text is where I set the string that is passed to the radeditor. This is the string that I would like to be able to add a line break (or similar) to.

var description = "The diagram with GUID = " + guid + "(Version=" + version + "Published=" + date + ") has a problem as described below...[Please Describe the problem]";

Let me know if you need anything else.

Thanks

David

<script type="text/javascript">  
if(typeof jQuery=="undefined"){  
    var jQPath="https://*********/";  
    document.write("<script src='",jQPath,"jquery-1.3.2.min.js' type='text/javascript'><\/script>");  
}  
</script> 
<script type="text/javascript" src="https://********/jquery.jqURL.js">  
</script> 
 
<script type="text/javascript">  
 
var tdClassToFind = '.ms-formbody';  
 
fields = init_fields();  
 
$(document).ready(function()   
{  
 
var guid = $.jqURL.get("GUID");  
 
var diagramName = $.jqURL.get("DiagramName");  
 
var version = $.jqURL.get("Version");  
 
var date = $.jqURL.get("Date");  
 
origin = getInputTagName("Origin");  
   
$("span[title=Improvement Suggestion]").children().attr('checked', true);  
 
if( diagramName != null )   
{   
    var guidRef = $(":input[title='Title']");  
    if( guidRef.val() != undefined )   
    {  
        guidRef.val("Issue with Diagram: " + diagramName);  
    }  
}  
 
if( guid != null )   
{   
    var processRef = $(":textArea[name$='RadTextField1']");  
    if( processRef.val() != undefined )   
    {  
        var description = "The diagram with GUID = " + guid + "(Version=" + version + "Published=" + date + ") has a problem as described below...[Please Describe the problem]";  
 
        processRef.val(description);  
    }  
}  
});  
 
/******* Function to get an array of all the form fields so that they can be found from their internal name ************/  
function init_fields(){  
  var res = {};  
  $("td" + tdClassToFind).each(function(){  
  if($(this).html().indexOf('FieldInternalName="')<0) return;  
  var start = $(this).html().indexOf('FieldInternalName="')+19;  
  var stopp = $(this).html().indexOf('FieldType="')-7;  
  var nm = $(this).html().substring(start,stopp);  
  res[nm] = this.parentNode;  
  });  
  return res;  
}  
 
/******* Function to get the input Tag 'name' ************/  
function getInputTagName(FieldInternalName){  
$(fields[FieldInternalName]).find(tdClassToFind + " tr:not('#SkipThisTR')").each(function(){  
radioname = $(this).find('input').attr('name');  
});  
return(radioname);  
}  
 
</script> 
0
Stanimir
Telerik team
answered on 04 Feb 2010, 08:22 AM
Hi David,
I apologies for the inconvenience, but could you confirm which version of RadEditor for MOSS you are using? This will make my test more accurate.

Thank you.

Regards,
Stanimir
the Telerik team

Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Follow the status of features or bugs in PITS and vote for them to affect their priority.
0
srinivasu
Top achievements
Rank 1
answered on 03 Feb 2011, 10:01 AM
Hi team ,

now i am Telerik Rad editor it sholud comminicate with Jquery.and can give me any examples for that
0
Stanimir
Telerik team
answered on 03 Feb 2011, 10:44 AM
Hi David,

Could you define the scenario or the functionality, which you are trying  to achieve with more details? If I get more information, I will be able to advise you more adequately.

In general you can find information of how to use jquery with RadContorls for ASP.NET AJAX in the following online help article: Using jQuery.


Greetings,
Stanimir
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
WebParts for SharePoint
Asked by
David
Top achievements
Rank 1
Answers by
Stanimir
Telerik team
David
Top achievements
Rank 1
srinivasu
Top achievements
Rank 1
Share this question
or