Page 1 of 1

Enhanced Rich Text

Posted: 13 Apr 2016
by mcgaafar
Hi,

I have a form with the following fields:

Link: Hyperlink Field - (ex.: hyperlink: "http://www.plumsail.com" , description: Plumsail)

Description: Multiline plain text - (ex.: SharePoint Solutions)

Formatted Description: Enhance Rich Text



I would the user to only fill in the link and the description fields, and get the form to auto populate the enhanced rich text accordingly following the example like this: <h3><a href="http://www.plumsail.com" target="_blank">Plumsail</a></h3><h2><span class="ms-rteThemeForeColor-3-0">SharePoint Solutions</span></h2><br>

Appreciate if you can help me achieve this.

Thanks,

Re: Enhanced Rich Text

Posted: 14 Apr 2016
by rostislav
Do you need to update the ERTF as soon as the user changes link or description or doing it before submitting is fine? My proposition would be to disable the ERTF field, and on submission enable it and fill it in.

Re: Enhanced Rich Text

Posted: 14 Apr 2016
by mcgaafar
Both scenarios are fine with me.

Re: Enhanced Rich Text

Posted: 14 Apr 2016
by mcgaafar
i only need to know how to do it, i struggled to get it work without any luck.

Re: Enhanced Rich Text

Posted: 14 Apr 2016
by rostislav
Check internal names. You can also just hide the formatted description field with CSS ('display: none;')

Code: Select all

fd.field('FormattedDescription').readonly(true)
fd.onsubmit(function(){
	fd.field('FormattedDescription').readonly(false);
	fd.field('FormattedDescription').value('<h3><a href="'+fd.field('Link').value()[0]+'" target="_blank">'+fd.field('Link').value()[1]+'</a></h3><h2><span class="ms-rteThemeForeColor-3-0">'+fd.field('Description').value()+'</span></h2><br>');
	return true;
});