Multiline Rich Text field
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
- Dmitry Kozlov
- Site Admin
- Posts: 1524
- Joined: Thu Jun 07, 2012
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:
But your code should work as well.
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:
Code: Select all
fd.field('Text').value()
-
- Information
-
Who is online
Users browsing this forum: No registered users and 25 guests