Set a rich text field on load

Discussions about Forms Designer for SharePoint 2010.
Locked
User avatar
Sebastian Haugland
Posts: 43
Joined: Fri Sep 19, 2014
Contact:

23 Sep 2015

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"

User avatar
rostislav
Moderator
Posts: 364
Joined: Mon Oct 19, 2015

23 Sep 2015

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>');

User avatar
Sebastian Haugland
Posts: 43
Joined: Fri Sep 19, 2014
Contact:

23 Sep 2015

Thanks :) don't know why I thought I had to write before form load...

Locked
  • Information
  • Who is online

    Users browsing this forum: No registered users and 10 guests