Stump the Panel » jQuery for Everyone

Prepopulate html in a Rich Text form field

(4 posts)
  • Started 3 months ago by ewnash
  • Latest reply from AutoSponge
  1. ewnash
    Member

    Disclaimer: I'm a jQuery novice so this may be elementary but here goes.

    I have a custom list that has a body text field that I want to prepopulate and preformat with some HTML. I can easily copy/past the HTML into the source editor version of the rich text field but users find that confusing and would like the contents (think of a blank tabular "form" in HTML) prepopulated.

    I've read up a bit via Paul's jQuery for Everyone series and have downloaded the SPFF project but I'm having trouble working out exactly where in the CEWP to specify the field and the contents. By way of example:

    -The list is at /server/site/lists/SRO
    -The target multi-line text column is called SRODetails
    -The default contents are HTML that renders the desired table

    Any help as to where to insert the requisite code into the CEWP would be much appreciated!

    Posted 3 months ago #
  2. Using the SPFF (no guarantees it will work with a custom page), you only need to include the script and call it (several examples on the project page).

    After that, all instructions to open/close fields, lock fields, or prepopulate them must be passed in the URL. So you have to build your links to the page with the prepopulate options already in the link.

    Posted 3 months ago #
  3. ewnash
    Member

    Thanks Paul; I somehow missed the fact that anything that you want to prepopulate has to be passed in the URL. Chalk it up to SharePoint-induced impaired comprehension. Unfortunately the HTML that I had hoped to prepopulate is far too long for the URL string.

    If there's another jQuery solution that you'd suggest given the field type and the large amount of HTML to be passed then I'd love to hear it. I'm tinkering now with the value attribute method that Paul Galvin posted in his "Use jQuery to Set a Text Field" posting but I don't know if it's the right solution for this particular need.

    Posted 3 months ago #
  4. There are a couple of other options. First, you can hard-code the prepopulation text using something like Paul's post. Second, you can offer multiple "blocks" of text/html linked to buttons on the page. Third, you can put the text in another list and use web services to fetch the right text for the user's context.

    Posted 3 months ago #

RSS feed for this topic

Reply

You must log in to post.