Multiline Rich Text field

rss

Posted by SpencerD - Mar 6 ’17 at 05:17

Hi Dmitry,

I was struggling to get the value of a regular multiline rich text field (not a multiline extended RTF) from my NewForm's Save button Onclick event using the .replace(/\W/g) examples shown on this forum, but finally managed to get the inputed values and evaluate with the following:

var details = fd.field('Details').control()._el().find('.ms-rtelong').contents().find('body').text();

//alert('Details value: ' + details);

if (details == null || details == '') {
alert('Sorry, Details is a required field, please enter a value.');
return false;
}

I'm concerned this is not covering all possible test cases since I'm not doing the evaluation of char replacement, however testing blanks and carriage returns in the input field are getting caught correctly.

Do you see any potential issues with using the above, or have any comments for improving?

Thanks in advance, and appreciate the help your posts have given.

Thanks,

Spencer

  • Dmitry Kozlov
    Dmitry Kozlov
    Admin
    Member for: 6 years 2 months 20 days
    #1 by Dmitry Kozlov Mar 7 ’17 at 04:25

    Hi,

    What's your Forms Designer version - you can find it in the lower-right corner of Forms Designer window. The current version supports getting value of an RTE field:

    fd.field('Text').value()

    But your code should work as well.

  • SpencerD
    Member
    Member for: 2 years 9 months 4 days
    #2 by SpencerD Mar 7 ’17 at 09:46

    Ah, I see I'm not up to the latest version which is why that wasn't working for me.  Time to upgrade!

    Thanks again!

Displaying 1 to 2 of 2 messages