FileMaker’s default Paste behavior is to paste formatted text in a FileMaker text field. Additional steps, either by the user or the developer, must be taken to paste unformatted text. Text stored with custom formatting may interfere with readability issues, especially when a print layout is designed to display a company name in 18 pt Arial Bold, but instead displays it in 12 pt Comic Sans (because that’s what was originally pasted into the field).
In the animation below, you will see a user copying and pasting contact info into a Contacts database (a Starter Solution created with FileMaker Pro 15). There are no special steps being taken; just a very common method for data entry.
Even though the pasted text looks the same, it is different, and can cause problems down the road. The FileMaker fields are formatted to use Helvetica Neue using a dark gray color, but the pasted text is actually black Lucida Grande.
Attached is a very helpful sample file detailing five different ways to deal with pasting text in FileMaker:
- Undo
- Paste Text Only
- Auto-Enter Calculated Value
- Script Trigger
- Custom Menus
Download the sample file here:
Solution 1: Undo
After pasting in the field choose Undo Formatting from the Edit menu or press Command-Z. Selecting Undo a second time undoes the paste operation altogether.
Pros:
- Native FileMaker functionality.
- Allows user to decide if formatting should come through at the point of the operation.
Cons:
- Method is not a standard practice.
- Users are generally not aware of this feature.
- Feature is only revealed after initial paste takes place (users often don’t understand they have to hit Undo twice to remove pasted text).
- Relies on the diligence of the user; users will not consistently apply this technique.
Solution 2: Paste Text Only
FileMaker has a feature that requires no custom menus or scripts. There is a Paste Text Only command in the Edit menu. You just have to remember that Paste Text Only uses the keyboard command Option-Shift-Command-V.
Pros:
- Native FileMaker functionality.
- Allows user to decide if formatting should come through at the point of the operation.
- Shares standards with other common programs. The same keyboard combo is used for macOS apps’ “Paste and Match Style” and Word’s “Paste and Match Formatting”.
Cons:
- Not the default Paste behavior.
- Clunky keyboard combo.
- Relies on the diligence of the user; users will not consistently apply this technique.
Solution 3: Auto-Enter Calculated Value
Developers have the option to automatically strip out all formatting (whether brought in via Paste or applied directly in the field by the user). Go to field Options > Auto-Enter > Calculated value, and make the calculation TextFormatRemove(Self). Make sure to uncheck the “Do not replace existing value of field” checkbox to ensure that this behavior will be applied at all times.
Pros:
- Developer can control exactly which fields receive this treatment.
- User does not have to worry about formatting decisions.
Cons:
- Slight possibility for confusion as the text will appear as formatted for the user, then will become unformatted on field exit.
- Must be applied to each field.
- Removes choice from user; sometimes it is useful to allow user to apply text formatting to field contents.
Solution 4: Script Trigger
With the advent of script triggers, developers now have the option to test field data immediately, and take appropriate steps via script. Users can even be prompted for what they’d like to have happen. In this example, the script checks to see if there is formatted text when the field is saved; if there is, it prompts the user if they want to keep it or strip it out.
Pros:
- Developer can control exactly which fields receive this treatment.
- The same field can have different behaviors because the script trigger can be applied differently on a layout-by-layout / field-by-field basis.
- User can be prompted for formatting preference.
- Scripted approach opens up user-level custom formatting privileges (i.e. Jane can be trusted to apply custom formatting, but Bob cannot).
Cons:
- Must be applied to every instance of a field for maximum consistency.
- Too many script triggers can be annoying and unwieldy.
Solution 5: Custom Menus
For many developers, the previous options are not attractive; relying on the user or applying fixes to hundreds (or thousands) of fields is not feasible. Custom Menus allow developers to harness the Paste operation at its source, and make Paste do whatever we want. The basic concept is to assign an override behavior for a standard command. In this case we will simply reverse Paste with Paste Text Only, using the Paste [No Style] step:
To see how this is set up in this file, go to File > Manage > Custom Menus… > No Styled Paste > Edit Copy > Paste Text Only. If you go this route, take special care to set up menu items that mirror FileMaker’s default menus, and don’t forget to make your new menu set the default for the file. Click the Toggle button below to test out the functionality for yourself:
Pros:
- Developer can apply this fix once per FileMaker DB file, saving time.
- User does not have to worry about formatting decisions.
- Additional custom menu item can be configured for situations where user may want to retain formatting in pasted text.
Cons:
- Can be tricky to set up correctly.
- The ⌥⇧⌘V keyboard shortcut does not appear to work.
- Removes choice from user; sometimes it is useful to allow user to apply text formatting to field contents.
- Paste operations based on Paste [No Style] do not appear to work in dialog boxes such as Show Custom Dialog and Re-login.
Bonus Solution: Scripts Menu
Here is a possible script for pasting text without styles:
Assign this to the top of the Scripts menu with default keyboard ⌘-1 or CTRL-1.
Pros:
- Simple to implement
Cons:
- User needs to learn a new keystroke combination for Paste.
- Inconsistent across other applications.
Conclusion
At LuminFire, we use both auto-enter calculations (option 3) and custom menus (option 5). We also use a specially designed custom function that handles several different formatting issues. If you have FileMaker Pro Advanced, you can take a peak at the Reformat() custom function in the sample file and adapt it to your solution.
A special paste script is assigned to a custom menu to get a different keyboard command. Our fmIgnite framework, uses Shift-Command-V as Paste Formatted and the default Command-V would Paste (Unformatted) which is what you want in the majority of situations.
It’s amazing how much work and thought can be put into even a simple user interface detail. Our goal is to make the FileMaker experience the best it can be. Each design decision we make should be based on knowledge and experience. We look at all the possible solutions and choose the best one we can for the situation.
We believe FileMaker should always paste unformatted text by default. A FileMaker solution is a database, not a desktop publishing app or a presentation. It should be up to the developer to enable custom formatting on specific fields. Here are a couple of Product Ideas that FileMaker Inc. looks at when shaping the future of the product. Please take a look and consider upvoting if you agree! Field Option: Remove Format/Style On Input and Option for non formattable text in input fields
References:
- Pasting without Text Style
- How to Paste Text in a Field Without Pasting the Format
- Automating Paste and Match Style in FileMaker
- Script Trigger example by Ocean West
- Unformatted(Text) function – Now replaced by the built-in TextFormatRemove(Text) function