Page 1 of 1

Set a rich text field on load

Posted: 23 Sep 2015
by Sebastian Haugland
Hi

I think you have replied to this before but I cant find it...

I have a rich text field called "Description" and want to add a new line with the date automatically when the user hits a button - so that he can add text to the field fafter the date. As far as I remember you can't do this and a workaround was to add the line on load / before the form becomes visible.

How do you do that? either from a button or from "form load"

Re: Set a rich text field on load

Posted: 23 Sep 2015
by rostislav
Just add the following code to the onclick handler for the button in Forms Designer:

Code: Select all

fd.field('Description').control()._el()
  .find('.ms-rtelong').contents()
  .find('body').html('<p>your date value goes here</p>');

Re: Set a rich text field on load

Posted: 23 Sep 2015
by Sebastian Haugland
Thanks :) don't know why I thought I had to write before form load...