Jump to content
Server Maintenance This Week. ×

how to enforce one font style in a field


This topic is 6216 days old. Please don't post here. Open a new topic instead.

Recommended Posts

I found a great tip on Pasting Without Style to paste unstyled text into a field. But that still requires the user do that every time. If the user forgets then you are back to having a problem of styled text in a field.

I also see that when defining fields, you can Auto-Enter a Calculated Value then use the Text Formatting Functions to select a style. Is this the "best practice" way to strictly enforce field styles? Or is there a simpler way that I'm overlooking?

Link to comment
Share on other sites

Thanks!

I ran some quick tests, and it appears to me that the calculation isn't run on pre-existing fields until you make any edit in the field. Just clicking in and out of the field didn't cause the calculation to run. Or am I missing something?

Link to comment
Share on other sites

A Replace Field Contents, with the field as the source would update existing records (be sure to make a backup before playing with Replace).

In general, I would recommend stripping formatting out of field data, and instead applying formatting to the fields on the layouts. If the field data has formatting, it will override the layout's field formatting, which can be a big nuisance (think of all the forms or reports that might require different fonts or font sizes from the data entry/view screens).

To remove formatting of data entered into a field, define an auto-enter calc option on your field (with the 'Do not replace' option unchecked):)

TextFormatRemove(Field)

or for FM7 compatibility:

Evaluate(Quote(Field))

This too would only affect new data entry, so that Replace trick would be needed to refresh existing records.

Link to comment
Share on other sites

If you don't want to apply an auto-enter calc to all your fields, you could make a script containing the command Paste[No style]; then set up custom menus so that your script is called by the Paste command in the Edit menu.

Link to comment
Share on other sites

This topic is 6216 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

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