Stump the Panel » End Users and Information Workers

default text in multi-line text block

(8 posts)
  1. david m
    Member

    Hello,

    I need some advice. I have a custom list with a "multi-line text box" field that I'd like to put in some default text (to help guide the user). No avenue when adding the column and I haven't been able to get SPD to put anything in the block either. I saw this had come up a couple of months ago -- is there a way to do this?

    Posted 3 days ago #
  2. This should work. I haven't used it in multi-line fields but have used it for look up lists in the past. http://blogs.msdn.com/sharepointdesigner/archive/2007/06/13/using-javascript-to-manipulate-a-list-form-field.aspx

    Be sure to peruse the comments as there is a tidbit in there about using textarea as the selector for the textarea not textfield as listed.

    Posted 3 days ago #
  3. Jay
    Member

    I've also used the solution eric linked to because I needed to have default text for the Description field in one of my calendars to be set with specific formatted text.

    He's right about the textarea as the selector, use that instead of 'input'.
    You'll want something like this:

    function setTextAreaFromFieldName(fieldName, value) {
      if (value == undefined) return;
      var theInput = getTagFromIdentifierAndTitle("textarea","TextField",fieldName);
      theInput.value=value;

    The text I needed had to be blue and bolded.
    Here's what I used:

    setTextAreaFromFieldName("Description",('<font color="#0000ff"><b>Content:</b></font>
    <font color="#0000ff"><b>Class Highlights:</b></font>
    <font color="#0000ff"><b>Target and Recommended Audience:</b></font>
    <font color="#0000ff"><b>Class Dates/Times:</b></font>
    <font color="#0000ff"><b>Sign Up Sheet:</b></font>
    <font color="#0000ff"><b>Class Length:</b></font>
    '));
    Posted 3 days ago #
  4. david m
    Member

    Thank you Eric and Jay for the great feedback -- lets make sure I've got this right ---(I'm still in my learning curve)
    I've got my custom list with the multi-line text box fields (I've got 2 on this list) -
    I go into SPD, copy the NewForm.ASPX, open it, click on the field - then go to code view (or be in split screen). From this point I'm unsure about where to insert the script. Do I put in after the <tr> ? Or somewhere else?

    Thanks in advance for your great help.

    Posted 2 days ago #
  5. Place it just after PlaceHolderMain.

    <asp:Content ContentPlaceHolderId="PlaceHolderMain" runat="server">
    
    <script type="text/javascript">
    Your Script
    </script>
    
    <table cellpadding=0 cellspacing=0 id="onetIDListForm">
    Posted 2 days ago #
  6. david m
    Member

    Eric, thank you so much for your assistance. After thinking about this (and getting some feedback), what I really would like to do is have the multi-line text box (with Rich Text option applied) default to numbering (vs Bullets). Can we do this?

    Thank You.

    Dave M

    Posted 2 days ago #
  7. I'm sure it can be done. The code would have to be monkied with to get it right most likely. I have only used the above method to set default values in lookup lists so it would take a bit of testing for me to figure out the multi-line fields.

    Posted 1 day ago #
  8. Nelson
    Member

    Hello Eric,

    Thanks for the reply. I know you're busy and I also know that this is not an emergency -- HOWEVER, if you do find yourself with some open time, I'd very much appreciate you taking a second look at this.

    Thanks
    Dave M

    Posted 1 day ago #

RSS feed for this topic

Reply

You must log in to post.