Prepopulate RadEditor

6 posts, 0 answers
  1. David
    David avatar
    2 posts
    Member since:
    Sep 2008

    Posted 28 Jan 2010 Link to this post

    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
  2. Stanimir
    Admin
    Stanimir avatar
    1653 posts

    Posted 28 Jan 2010 Link to this post

    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.

  3. David
    David avatar
    2 posts
    Member since:
    Sep 2008

    Posted 03 Feb 2010 Link to this post

    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> 
  4. Stanimir
    Admin
    Stanimir avatar
    1653 posts

    Posted 04 Feb 2010 Link to this post

    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.
  5. srinivasu
    srinivasu avatar
    2 posts
    Member since:
    Feb 2011

    Posted 03 Feb 2011 Link to this post

    Hi team ,

    now i am Telerik Rad editor it sholud comminicate with Jquery.and can give me any examples for that
  6. Stanimir
    Admin
    Stanimir avatar
    1653 posts

    Posted 03 Feb 2011 Link to this post

    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.
Back to Top