4 Replies Latest reply on Nov 22, 2011 11:14 AM by ErikWegweiser

    Text formatting within fields

    JulianJohnson

      Hi All,

       

      I've come up against an issue, which I think is a lack of knowledge of how this should behave on my part.

       

      There are three tables concerned, a promotions table, contacts table and recipients table that links one promotion to many recipients/one recipient to many promotions.

       

      I have a field on a screen formatted layout that is used to hold the text for the body of a letter and the client either types or pastes a block of text into the field. They then apply styling tot he text to add fonts, sizes bold, colours and alignment etc.

       

      When the letter is sent out, there is a recipient list held in a related table holding the link to the contact records for those who should recieve it. The send script performs a Go To Related Record to the recipient list in a letter sized layout. The body of the text on the layout is the same field that they used to enter and style the text on screen. (It is from the exact same table occurrance - GTRR has not jumped to another anchor-buoy block of TOs)

       

      The issue I have is that styling changes made in the promotions layout aren't then appearing in the letter layout. Should styling changes made in a field in one layout then appear in the same field in another layout when it based on the same field in the same TO. Is there soemthing I need to switch on/off etc in order to get the changes to appear?

       

      Thanks in advance.

      Jules

        • 1. Re: Text formatting within fields
          RayCologon

          Hi Jules,

           

          There are two distinct types or levels of text formatting: layout level formats - the kind applied to the enclosing object ()eg a field box) in layout mode, and character level formats applied directly to text in a field in Browse mode.

           

          Styling changes applied directly to selected text within a field (eg a text field) - as opposed to changes made to the style specifications of the field box in Layout mode - alter the appearance of the text in fields placed on other layouts, except insofar as unspecified formatting parameters will be subject to differences in the Layout mode formats applied to the containing field object.

           

          So, for example, if you have a field formatted to display text in Times 10pt, and in Browse mode you select a word and change its font to Arial, then switch to a layout where the field object has a default font (ie applied to the field object in Layout mode) of Courier 12pt italic, then the word you explicitly changed to Arial will now show in Arial 12pt italic (because you set an explicit font but not the size or other style paramters, so the size and italicization are following the field default but the font is respecting your change). Meanwhile, the rest of the text in the field (that you didn't apply any character-level formatting to) will show in Courier 12pt italic.

           

          In other words, changes will be applied, but the effect may be different if the layout level format is different, as that provides the default for all text that hasn't been explicitly formatted at the character level.

           

          Regards,

          Ray

          ------------------------------------------------

          R J Cologon, Ph.D.

          FileMaker Certified Developer

          Author, FileMaker Pro 10 Bible

          NightWing Enterprises, Melbourne, Australia

          http://www.nightwingenterprises.com

          ------------------------------------------------

          • 2. Re: Text formatting within fields
            JulianJohnson

            Hi Ray,

             

            Thanks for your detailed reply.

             

            What you said is exactly how I understood it to work, more intuitively rather than through me analysing it. However, in the system I have here from my client, it was appearing to behave differently.

             

            I've had another go and got to the bottom of it. I think the issue was that the field already had a lot of formatting on it at layout level, plus the text was pasted in from Word with formatting on it.

             

            I switched off some of the formatting on the layout, in particular Bold and then pasted the text in as plain text then applied the formatting required in the field and it appears to work now.

             

            Thanks for your help.

             

            Kind Regards

            Jules

            • 3. Re: Text formatting within fields
              Stephen Huston

              Hi Jules,

               

              One of the things I recommend doing is changing the behavior of the Paste command via Custom Menus.

               

              Set it so the default Com-V process uses the Paste WITHOUT STYLE script step.

               

              You can leave the formatting options available if they intentionally want to format text once it's in the field and re-selected for formatting, but changing the Paste command will strip out any pre-existing styles coming in with the pasted text.

               

              This makes for a lot less accidental data formatting, especially if your users copy/paste a lot of data.

              • 4. Re: Text formatting within fields
                ErikWegweiser

                Hello, Jules:

                 

                I'll chime in with another option I frequently use with many data entry fields. I'll set the auto-enter calculation of fields to strip away or force specific formatting (among other things, like remove extra returns and spaces). It's handy to have custom functions for this. For instance, I may want to prohibit any character-level formatting at all. In which case, I'd use

                 

                     TextFormatRemove( text )

                 

                I may want to allow the user to edit character-level formatting or paste formatted text from other sources (like a word processing document or a web browser), so long as the enter text font and size display in those of the field's layout formatting. I'd use

                 

                     TextSizeRemove( TextFontRemove( text ) )

                 

                Similarly, you can force the entire contents of the field to have only a particular style or font.

                 

                     TextFont ( text ; "Gill Sans")

                 

                You could do this with script triggers as well.

                 

                ------------------------------------------------

                Erik Wegweiser

                Intelligent Database

                Boston, MA

                http://intelligentdb.com