HTML Richtext field

rss

Posted by Sebastian Haugland - Oct 26 ’15 at 10:19

Hi

See A to C below.

I mangage to write RichText from a object (obj.street below)  to a list field of type "Rich text" - se A .

In a HTML section with custom javascript I also manage to write plain text to a <p id="demo3"></p> in the Body see B.

But I cant manage to write Rich text in to a field in my HTML body (it returns ony plain text) - see C. , have tried with

<p id="demotest"></p> and

<textarea id="demotest" rows="3" cols="20">
Enter text here...
</textarea>

But neither works - what is the correct tag ? / suggestions?

 

Code:

 

A

fd.field('Body').control()._el()
.find('.ms-rtelong').contents().find('body').html(obj.street);

B

var x1 = document.getElementById("Name");
x1.value=obj.name;

C
var x8=document.getElementById("demotest");
x8.value=obj.street;

  • rostislav
    rostislav
    Moderator
    Member for: 8 years 22 days
    #1 by rostislav Oct 26 ’15 at 11:56

    Inserting html inside a <p> tag should work (assigning html-formatted text to a textarea will just give you your html as plain text). Are you sure the value you're inserting is html? do a console.log(obj.street) to check you have your html formatting before you do your assignment.

  • Sebastian Haugland
    Sebastian Haugland
    Member
    Member for: 8 years 2 months 5 days
    #2 by Sebastian Haugland Oct 26 ’15 at 02:37

    I am inserting Rich text . at least its text from a Sharepoint Richtext field. It looks like this: <P><FONT color=#ff0000>Not </FONT><FONT color=#00ffff>Working</FONT></P>

    representing this:Not Working

    As I mention I can store it back in another Sharepoint Richtext field but I can't manage to store it in the body of my custom HTML.

    (Reason for doing this is to avoid using so many SHarepoint fields by storing Richtext field as JSON and then read/write to them from a custom HTML section - and its working for chekboxes and plaintext but not for Richtext)

  • Sebastian Haugland
    Sebastian Haugland
    Member
    Member for: 8 years 2 months 5 days
    #3 by Sebastian Haugland Oct 26 ’15 at 02:40

    I am inserting Rich text . at least its text from a Sharepoint Richtext field. It looks like this: <P><FONT color=#ff0000>Not </FONT><FONT color=#00ffff>Working</FONT></P>

    representing this:Not Working

    (Not in Red and Working in Cyan)

    As I mention I can store it back in another Sharepoint Richtext field but I can't manage to store it in the body of my custom HTML.

    (Reason for doing this is to avoid using so many SHarepoint fields by storing Richtext field as JSON and then read/write to them from a custom HTML section - and its working for chekboxes and plaintext but not for Richtext)

  • rostislav
    rostislav
    Moderator
    Member for: 8 years 22 days
    #4 by rostislav Oct 27 ’15 at 05:38

    [#3]:

    You should have used innerHTML instead of value. However, it's easier to do it with jQuery:

    $('#demotest').html('<P><FONT color=#ff0000>Not </FONT><FONT color=#00ffff>Working</FONT></P>');
    
  • acquiro
    Member
    Member for: 3 years 3 days
    #5 by acquiro Jun 23 ’20 at 01:19
  • Benther
    Member
    Member for: 2 years 7 months 28 days
    #6 by Benther Oct 1 ’20 at 02:03

    [#4]: Thanks for the advice. It helped me too, I often get confused with tags in my work.

    Ben, an aditor at https://papernow.org/buy-college-papers
  • Benther
    Member
    Member for: 2 years 7 months 28 days
    #7 by Benther Oct 1 ’20 at 02:05

    [#4]: Thanks for the advice. It helped me too, I often get confused with tags in my work.

    Ben, an aditor at https://papernow.org/buy-college-papers
  • skytaxitw
    Member
    Member for: 7 months 10 days
    #8 by skytaxitw Oct 19 ’22 at 06:30

     

    The topic here i found was really effective to the topic which i was researching for a long time

    Thanks for Sharing

    Taxi Tunbridge Wells

     

  • jonemartin
    Member
    Member for: 10 months 13 days
    #9 by jonemartin Mar 15 ’23 at 02:26

    A rich text editor is an interface or input field for text editing, that includes advanced styling options like heading levels, bold, italic.

     

    Visit website link https://bestcarpetcleaningusa.com Professional Carpet Cleaning Companies in USA

  • jerry
    Member
    Member for: 2 months 22 days
    #10 by jerry Mar 15 ’23 at 06:29

    Embedding html inside a <p> tag ought to work (doling out html-organized text to a textarea will simply give you your html as plain text). Could it be said that you are certain the worth you're embedding is html? do a console.log(obj.street) to check you have your html designing before you finish your task.

     

    Visit website link https://bestbailbondsusa.com Top Bail Bond Companies in USA

Displaying 1 to 10 of 14 messages
Previous12