5 Replies Latest reply on May 29, 2007 3:51 AM by RoboColum(n)

    Font options in Multi-Line Text fields

    RoboColum(n) Level 5
      I think I know the answer to this one but I want to check before I tell someone it can't be done.

      One of our developers is producing a help file that contains code snippets in a multi-line text form element inside a form. He wants to be able to format the code to have different colours on different lines but I've not found a way of doing this without affecting ALL the code in the field. Does anyone know a way around this?
        • 1. Re: Font options in Multi-Line Text fields
          Captiv8r Adobe Community Professional & MVP
          Hi Colum

          I think that with these beasties, it's all or nothing. I think any application of coloring will affect the content of the entire field.

          Cheers... Rick
          • 2. Re: Font options in Multi-Line Text fields
            RoboColum(n) Level 5
            Yep...thought so. Thanks for confirming Rick. This whole episode came about because the developer originally had the code is an ordinary table cell. Trouble was that when you copy and paste from a table cell you get an additional carriage return at the end of each line. The only way around this that I found was using the multiline text field.
            • 3. Re: Font options in Multi-Line Text fields
              Captiv8r Adobe Community Professional & MVP
              Hi again Colum

              Is this inside a .CHM file? While it would mean more work for you, I've developed some JavaScript code that allows me to click a word and have desired text automagickally copied to the Windows clipboard. Wondering if that could help here.

              If it's WebHelp, I'm doubtful it would work. Might in IE, but would probably fail in others. Or, you could do both. Use the table cell for the color coding display, then insert the text field to store the contents of what you wish to copy. Then on click have some script that selects the text so all they do is press ctrl+C to copy it.

              Just some thoughts from a bald midwestern madman on a humid Tuesday morning... Rick
              • 4. Re: Font options in Multi-Line Text fields
                RoboColum(n) Level 5
                Hi Rick. Hope you've not melted by now . I was talking - well ok drinking - with Peter last night who mentioned the "link" button you guys use in RoboKnowledge. Is this what you were referring to? It sounds promising as it is a CHM file we are dealing with here.
                • 5. Re: Font options in Multi-Line Text fields
                  RoboColum(n) Level 5
                  OK. I've managed to work out a Javascript option that works and am posting here for anyone's future reference. First off, genererate a single cell table and format the text (code snippet ) as required. Next create a form containing a button and a multi-line text field. In the <HEAD> section paste:

                  <script LANGUAGE=JavaScript
                  type="text/javascript">function copy2Clipboard(element)
                  {
                  element.select(); // Only works for text boxes.
                  textRange = document.selection.createRange();
                  textRange.execCommand("RemoveFormat");
                  textRange.execCommand("Copy");
                  }</script>

                  Change the button properties to Control Type = Plain Button, Button Caption = Copy to Clipboard, Control Identifier – Delete the default value to leave a blank field. Also add Add onclick="copy2Clipboard(namehere)" to the end of your <input type=submit value=Button> statement.

                  Change the multi-line text field properties to Control Identifier = namehere (where namehere is the value you specified above), Initial text = Paste the code snippet to be copied to the PC clipboard. Also add style="height: 1px; width: 0px;" to the end of the multi-line text area code.

                  Note: If the above style statement is set to style="height: 0px; width: 0px;"> a bug generates acres of blank space between the end of the multi-line text box and any other following content. If the multi-line text box is the last part of the topic content this is OK but otherwise the code above must be used.