Multiline Rich Text field
Posted: 06 Mar 2017
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
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