Jump to content
Sign in to follow this  
JTSmith

How to paste text in a field, without pasting the format?

Recommended Posts

A lot of my fields are filled with content pasted from websites. In FM11, I never had this problem, but FM12 paste's the font, color, and blue text links. Is there anyway to change it so it pastes just plain text?

Thanks!

Share this post


Link to post
Share on other sites

Except for a changed keyboard shortcut (at least under Mac OS X), this hasn't really changed from FM11 to FM 12. To paste manually, choose “Paste Text Only” from the “Edit” menu, or use the associated keyboard shortcut.

If you have a field where you are sure to never need formatting, you can automate the removal of formats by setting an Auto-Enter option, like “TextFormatRemove (Self )”. Make sure to deselect the “Do not replace existing value …” checkbox. After pasting, at first you see the formatted text, but as soon as you leave the field the formatting will be stripped. This also works if you add formatted text to existing one.

Be aware that as long as the auto-enter option is active, you can't even manually add styles.

If you already have fields with text formatting you want to get rid of, either cut the text and paste it again as described above, or after setting the auto-entry option (if desired), paste in anything and then cut it to trigger the calculated replace. (Seemingly simply entering and exiting the field does not work.)

Share this post


Link to post
Share on other sites

In FM11, I never had this problem, but FM12 paste's the font, color, and blue text links.

I can confirm your experience with FM12. Fonts, sizes, styles ... they're all brought in. They've made a fundamental change in they way they process pasted or dropped text ... and didn't bother to tell anyone. This one has huge impact for my application. It's one of several "undocumented features" I've encountered in trying to convert — and it could be the show stopper.

Share this post


Link to post
Share on other sites

Nope, formats have come across with copied and dropped text since FMP 7.

After pasting the text, issue the Undo command (Ctrl-Z) and FMP will remove the formatting -- at least it does in FMP 11.

Even better, set the field up with an auto-enter calculation = TextFormatRemove( Self ) and the formatting will always be removed.

Share this post


Link to post
Share on other sites

They've made a fundamental change in they way they process pasted or dropped text ... and didn't bother to tell anyone.

Sorry, Vaughn. I know you're one of the more experienced forum members, but what you're declaring doesn't change our reality.

What JT and I are describing is a default behavior of plain text fields in our applications.

I started with FileMaker 8.0 and have routinely upgraded to every new version when it became available. Most of my work is centered around a rather large application involving hundreds of text fields across dozens of tables and over 100 layouts. It uses the separation model and is built as a runtime. I have installed it on dozens of PCs and run it under XP, Vista and Win 7.

Never once have I witnessed anything other than the text dropping in and dutifully taking on the style of the receiving field. I've always considered this default behavior to be a big plus of FileMaker and never gave it a second thought.

With FM12, something they've done has changed this field-level behavior on PCs.

So, if you know of a global setting that controls this FMP behavior, we'd certainly like to know. But suggesting that it isn't happening on our applications isn't helpful.

post-81548-0-35941000-1334845604_thumb.p

Share this post


Link to post
Share on other sites

Just a hypothesis, folks: this may be a Mac-familiar behavior that's suddenly affecting Windows users. Looking at who has said what, that's my guess.

Working on a mac, I'm used to killing unwanted style by hitting "undo" after pasting -- or, of course, defining fields in advance so as to reject style info.

Your source application (for styled text on clipboard) may also make a difference -- some apps will copy style info to the system clipboard, but others won't.

Share this post


Link to post
Share on other sites

The change they made — and maybe it's on PCs only — is clearly reflected in the right-click menu entry "Paste Unformatted Text". It was the default in FM11, while FM12 now says just "Paste".

Regarding the source application(s), my observations range over dozens of different applications and thousands of Paste "cycles". In spite of what the source app could or couldn't provide, no formatting ever found its way into text fields on my PCs before this change in FM12.

post-81548-0-23889700-1334880127_thumb.p

Share this post


Link to post
Share on other sites

What JT and I are describing is a default behavior of plain text fields in our applications.

What do you mean by "plain text fields"? FMP does not have plain text fields. Do you mean edit boxes?

There ARE behaviour differences between Mac and Windows so it's necessary that you state your platform. If you don't work cross-platform then you will not have noticed these differences.

Some of these differences have been removed in FMP 12 -- the ability to close windows when scripts are paused with user abort off is one of these (was not allowed on Mac, was allowed on Windows, now is not allowed on both). The pasting of formatted text may well be another but I don't think so.

What application are you copying from? Has it changed recently?

Share this post


Link to post
Share on other sites

What application are you copying from? Has it changed recently?

By plain text field I mean an edit box without any triggered script processing ... only a default font defined for it.

As for the "from" application, mostly IE 7 and 8 ... but any word processor or spreadsheet gives the same result. Like I've emphasized, this isn't an iffy thing. It always gives the same solid result in FM11, regardless of the source of the text.

But I have discovered just today that if you browse a website in FM12 from within FileMaker's Web Viewer — and drag a block of text from it to an edit box on the layout — the text drops in just as it always did on our PCs. It takes on the font and style of the receiving field.

So, the plot thickens. If there are indeed "rules", then the rules should be followed consistently. Else, the end user will be forever befuddled by the application.

My feeling is that FMI inadvertantly flipped a switch somewhere in FM12 and, once recognized, will flip it back — or better, give the option to the developer. Time permitting, I'll work up an example file to clearly demonstrate these differences.

Share this post


Link to post
Share on other sites

Can you re-produce this effect with a new database? Or does it only occur with your database converted from .fp7 format?

Share this post


Link to post
Share on other sites

I can confirm that on PC running FM 11 and FM 12 side by side. Copy the same text from a web page and paste into the same field in the original file and in converted file.

FM 11 - No Formatting is included

FM 12 - Formatting is included

Tested in Starter Solutions FM 12 - Formatting is included

Tested brand new file created in FM 12 - Formatting is included

Share this post


Link to post
Share on other sites

I'm using Windows Vista, FMPA12, Assets starter solution, and when I copy formatted text from the web to the notes field, the formatting is NOT included.

strange!

Share this post


Link to post
Share on other sites

One way to fix is change relevant fields to auto enter calc:

to remove format


TextFormatRemove ( Self )





to remove format & trim whitespace





Trim ( TextFormatRemove ( Self ) )





to remove format, trim whitespace & remove returns (eg. only want single line)





TextFormatRemove ( Trim ( Substitute ( Self ; "¶" ; "" ) ) )

Can extend enforce all sorts of rules this way. Asci only etc. and via custom functions

Cheers

Olly

Share this post


Link to post
Share on other sites

Those are good suggestions ... for anyone starting from scratch. I certainly recommend not leaving it to chance or to a flip-flop in a future release.

But my main app involves hundreds of fields. And did I mention it's based on the separation model? Changing field defs is not (now) an option.

I need a global fix. Hopefully, others are similarly impacted and FileMaker will bring forth a solution. A long-term solution would allow a field's font to be set to "default" or "any" or "determined by user".

Let me summarize this way: what good is a field's font/size/style definition if it's not honored by FileMaker at runtime?

Share this post


Link to post
Share on other sites

Here is a script for a trigger on a field - prompts if you wish to retain formatting.

formats.fmp12.zip

i remember an old hack - that also stripped formatting was: SerialIncrement ( yourField ; 0 )

Share this post


Link to post
Share on other sites

Those are good suggestions ... for anyone starting from scratch. I certainly recommend not leaving it to chance or to a flip-flop in a future release.

But my main app involves hundreds of fields. And did I mention it's based on the separation model? Changing field defs is not (now) an option.

I need a global fix. Hopefully, others are similarly impacted and FileMaker will bring forth a solution. A long-term solution would allow a field's font to be set to "default" or "any" or "determined by user".

Let me summarize this way: what good is a field's font/size/style definition if it's not honored by FileMaker at runtime?

It's worth pointing out that for the Mac version, formats have ALWAYS been pasted along with the text. Always. Like, forever. If you didn't want the formatting then you issued an Undo command, and FMP removes the formatting. Issue Undo again and it undoes the paste. Otherwise use the "Paste Text Only" command by holding the Option key down. (FMP 12 displays the Paste Text Only command explicitly, with FMP 11 and earlier it's an easter egg.)

It appears that FMP 12 has made the Windows version consistent with the Macintosh version.

As for FMP not honouring text formatting: huh? You have chosen to paste formatted text into the field. If you want plain text then use the "paste plain text" command or issue the undo command.

It's worth noting that some people WANT formatted text in their fields, and want to be able to copy and paste it in.

Share this post


Link to post
Share on other sites

I just did a test in Windows 7, FMP 11.0v3 using a fresh new Inventory starter template file.

You're right, formatting is not pasted. Usually. Links from web pages are pasted with formatting, but other text is pasted as "unformatted". So even with FMP 11, the formatting that comes across depends on the type of text being copied.

I don't have Ms Office installed on the machine yet, so cannot test copying from Word or Excel. Not that it matters to the outcome, which is that FMP 12 now behaves consistently between Mac and Windows versions with regard to pasting formatted text and the behaviour of window close box when scripts are paused (the subject of another discussion). In both cases the Mac behaviour is now standard.

There may be other features that have been made consistent...

Share this post


Link to post
Share on other sites

Here is a script for a trigger on a field - prompts if you wish to retain formatting.

formats.fmp12.zip

i remember an old hack - that also stripped formatting was: SerialIncrement ( yourField ; 0 )

Here is a script for a trigger on a field - prompts if you wish to retain formatting.

formats.fmp12.zip

i remember an old hack - that also stripped formatting was: SerialIncrement ( yourField ; 0 )

Thanks, works like a charm, I took the Dialog Prompt out since I never use the pasted format, but thanks for the upload!

  • Like 1

Share this post


Link to post
Share on other sites

By the way, my tests were done on Windows 7

Share this post


Link to post
Share on other sites

By the way, my tests were done on Windows 7

Ya I have 7 on the laptop at home I use to mess with FM, and XP on my office PC at work. Same thing on both...

Share this post


Link to post
Share on other sites

Sometimes text within a field has had formatting applied to it (color, bold, font, size, etc.). Formatting applied to text within a field will override field formatting applied to the field as a whole when in layout mode. It's possible to create conflicting formats by creating one format for a field object in Layout mode, and a contrasting format for field data in Browse mode. Here is how FileMaker Pro resolves text formatting conflicts:

  • When you format a field in Layout mode, the formatting affects only the appearance of that particular occurrence of the field object.
  • When you format field data in Browse mode, this formatting is stored with the data, and you see it in any layout that displays that field. Field data that is formatted in Browse mode takes precedence over data formatting in Layout mode. For example, if you format field text as Bold in Browse mode, then switch to Layout mode and format the same field as Plain Text, the text will continue to display as bold.

It is often desirable to remove this formatting in order to make the text in the field comply with the field's formatting.

The easiest way to achieve this is to use the TextFormatRemove function.

This removes all text formatting from text in a single action. All fonts, styles, font sizes, and font colors are removed from the specified text.

The following methods show how to implement these functions:

Method 1: Prevent text from being formatted during data entry.

A field can be defined to make sure data is entered in a specific format, or within a certain range. To save time and ensure accuracy, you can set FileMaker Pro to automatically enter unformatted data in a text, number, date, time, and container fields. For example, field.

To set options for automatic data entry:

  1. With the database open, choose File menu > Define > Database.
  2. In the Define Database dialog box, click the Fields tab.
  3. If your database contains more than one table, select the appropriate table from the Table list.
  4. Select your text field from the list of existing fields, or define a new one, for example fieldA.
  5. Click Options (or double-click the field name).
  6. In the Options for Field dialog box, click the Auto-Enter tab and select the Calculated Value (or click Specify), then enter the following calculation.

    TextFormatRemove(fieldA)
  7. To make an auto-enter calculation self-modifying, leave the Do not replace existing value for field (if any) option unchecked.

Since Auto-enter calculations can be self-referencing, this will ensure that any data that has been entered will be stripped of any text formatting.

Method 2: Remove existing text formatting using the replace command

You can replace the contents of a field in all records or in a found set with a calculation that also uses the TextFormatRemove function.

Important: This process overwrites a field in every record (or every record in the found set) with a new value. You can't undo replacing field values. Before you begin, consider making a backup copy of the file.

To replace field values in every record in the found set:

  1. If necessary, find, omit, or sort the records in the database file.
  2. In Browse mode, in the current record, select the contents of the field you want to replace, for example fieldA.
  3. Choose Records menu > Replace Field Contents.
  4. In the Replace Field Contents dialog box, select Replace with calculated result, then click Specify.
  5. In the Specify Calculation dialog box, enter the following calculation:

    TextFormatRemove(fieldA)
  6. Click OK.

This method is good for changing one field at a time on a given set of records or all records.

The following are alternative methods that will also achieve this:

Method 3: Manually reformat the text

To eliminate formatting applied in Browse mode, manually reformat the text in Browse mode.

Sometimes when there are a small number of fields and records involved, it is simpler to just select the text in question while in Browse mode and change it to the appropriate font, font size, and font style using the selections available from the Format menu (you can turn off multiple styles by using the plain text option). Make sure you select all the text in the entire field or else other layouts may not conform to the changes.

Method 4: Export and Import text

To eliminate formatting applied in Browse mode, export data as text and re-import the data.

This method is useful when multiple fields across multiple records are affected. The process of exporting and importing information as tab or comma separated text will strip a field's contents of its formatting. In order to use this method, find the affected records and export them to a tab separated text file. Then, import those records using the setting 'Replace data in current found set.

Important: Do not change your found set after exporting. Always, backup your database before executing a change like this, in case you make a mistake.

Additional information can be found in the following FileMaker Pro Help topics:

  • Exporting data from FileMaker Pro
  • Importing data into an existing file

http://help.filemaker.com/app/answers/detail/a_id/5674/~/removing-text-formatting-from-a-field-in-filemaker-pro

Edited by Fitch
Copyright © 1994-2012, FileMaker, Inc

Share this post


Link to post
Share on other sites

TextFormatRemove( Self )

Share this post


Link to post
Share on other sites

I am in the same situation as everyone one else that needs the formating for the field left as is when pasting form another application. I would much rather use the formatting that I have chosen for the field in that layout than it come over or at least have a flag in the Inspector that I can change for that field. Adding or changing trigger scripts for all of the fields in my DB's would be a catastrophic job for me. Having to press CRTL-Z or CRTL-SHIFT-V to keep the formatting out is a whole other issue as many of my users that have my compiled versions do not know this and don't need to learn new keystrokes because of an update to the software from FileMaker...

After reading the comments above its clear that FileMaker has let this one fall through the cracks and its causing a lot of issues for users and developers.

My suggestion would be to have an UPDATE to FileMaker namely the "Inspector" with the flag that "KEEPS" the pasted formatting or "USES" fields default formatting and have a utility that allows allows you to go and set the fields on a specific layout to what you need. This would be the best fix for all...

post-65263-0-64379600-1338309693_thumb.j post-65263-0-71809800-1338309708_thumb.j

GregR

FMPro 12 Advanced

Share this post


Link to post
Share on other sites

Hi Greg, and Welcome to the FMForums,

I can not read your enclosures, so I'm not following what your point is with them.

Please update your profile to reflect your OS, Platform and FileMaker information, here is a link http://fmforums.com/forum/index.php?app=core&module=usercp&tab=core&area=profileinfo

Lee

Share this post


Link to post
Share on other sites

I'm a bit late to this game, but I'll add my two cents, as my company is facing this same problem.

Adding any kind of auto-enter calculation to individual fields works fine for a small solution, but very impractical for a large, established work. Im my situation, it would take too long to add this to each and every text field. Having users change the way they paste text (CTRL-SHIFT-V) simply isn't going to work, because I can guarantee someone will forget down the line.

A much more elegant way of doing this is to change the custom menu Paste command, as Henk has suggested. I've tested this out and it works perfectly! If you don't have any custom menus setup already, then it's a small pain to get it setup, but MUCH better than changing this on a field-level basis. Plus you can 'turn off' this feature fairly easily if needed (by using either the default menuset or one that doesn't have the paste command overridden.

IMO - I like that FileMaker has 'fixed' this problem so people can paste formatted text on PCs, but it's really silly that they didn't peovide a global way to turn it off for users that were taking advantage of the "problem".

Share this post


Link to post
Share on other sites

ctrl shift V works for me on windows 7 to paste without text in filemaker 12. cmd shift V for mac, then?

Share this post


Link to post
Share on other sites

K1200 / Greg

 

Did you ever find a solution to this?  How frustrating!!!

 

hmm.... Setup calculations or triggers for more than a thousand fields? No thanks... 

 

Expect my users to paste in a certain way?? Not going to happen.

Share this post


Link to post
Share on other sites

You have a Thousand Fields that the users are suppose to paste data in?

 

Why not explain what it is that you are trying to accomplish, I'm sure we can help you better structure your file.

 

You can attach a copy of your solution by following these steps show here.

Share this post


Link to post
Share on other sites

Allright - have been fighting with this - another FM12 annoyance!  Another user mentioned "PasteNOSTYLE" in Customs Menu - and I was of to explore this in depth !  SUCCESS !

 

This way you can change the default way your users paste data in from anywhere, use the proper format and you DONT need to change any existing code, as described with "TextRemoveFormat(SELF)" or whatever.

 

The steps are here:

 

  • - Simply put, you create a script containing ONE line   ("Paste:Select:Nostyle") - call this CM_PASTE_TEXT
  • - Create (!) a Custom Menu for your application, name it something relevant (UserMenu ???)
  • - In this Custom Menu, you click on properties and select EDIT and you make sure you have the PASTE command somewhere in there - this you would change !
  • - The PASTE Command youll change to f.x "Paste Text" or whatever and NOW the magic begins...
  • - In the frame named "Menu Items", you´ll click on "Paste" and ind the right in the frame, you can among other things, specify a script to run when a user press - in this case - CTRL-V and assign the CM_PASTE_TEXT to this command.
  • - Finally - in order to get this to work, you need to specify (create) a NEW User Privileged Set - because you can EDIT this an change "Available Menu Commands"
  • - I use the "Editing Only" option, but you can also use the Full set - just NOT the Minimum - this dismisses the change to the Custom Menus you have just made...
  • - Remember to force your users to load and LOCK the new Custom Menu Set !

 

I hope you can get the general direction i´m going in - i apologize for my poor english, so i´m guessing from here ;)

 

Anyways, it´s working for ME and my 20 users - no user can now paste any cr*p into MY system ;)

 

Happy FileMaking from Denmark 

 

Regards, Lars

Share this post


Link to post
Share on other sites

I will start another thread...but when I have done this in the past the moderators seem to bark about starting a new thread for a topic that already exists.

Share this post


Link to post
Share on other sites

Hello Ahmet and Welcome to the FM Forums,

1 hour ago, Ahmet Cem Turan said:

hitting undo (Ctrl+Z) after Pasting

Please update your Profile to show the Version of FileMaker, OS and Platform you are using.

Instead of using copy and paste, you might want to look at Set Variable. 

The Script step is found here Paste [Select; No style; <table::field>]

Keyboard combos are found here

General keyboard shortcuts (OS X)

General keyboard shortcuts (Windows)

Lee

Share this post


Link to post
Share on other sites

The best practice for this is to set the field entry option to an auto-entered calc with Replace UNCHECKED and use TextFormatRemove (self) [which both Vaughn and eos mentioned at the top of this thread].

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.