Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Avoid carriage returns into fields

Featured Replies

Is there any way to avoid the insertion of carriage returns into fields ?

I need some fields to be one line only.

thank you

Hi Paolo smile.gif

Oh indeed there is! I fought the same problem. You can use validation by calculation in field definition like this:

not PatternCount(yourtextfield, "

  • Author

First, thank you.

This solves my problem only in part, since I'm trying to avoid CR at the time the user presses the key.

What I have is a "login" layout where the user types username and password (into two global fields) and then presses the "Ok" button that performs the validation check script.

User are used to press CR after they type the password instead of pressing "Ok". However this doesn't run the script, it only add a line in the password field.

Hi Paolo,

I'm trying to avoid CR at the time the user presses the key.

What I described would be in your "Field Definitions" using Validation by Calculation and would certainly stop a User from hitting return immediately when they did it. They they'd hit the OK button to run your script.

What version of FM are you using? Depending upon your version, you probably can validate a global field. To accomplish this, change your global text field to a regular text field in Field Definitions, apply the validation by calculation using the formula I provided then go back and change the field back to a global text field again. Users will be stopped COLD!! I promise. Regardless of whether you stop the User as soon as they hit enter, or whether you remove the carriage returns when the script runs, the Users will still have to hit the OK button to run the script. If you want the script to run upon field exit, you should use a plug-in.

LaRetta

Are you using a Set Field script step in moving the global to the permanent field?

If so, you could add the Substitute in your set field step. i.e.

Set Field [ [ YourRealField, Substitute(g_YourGlobalField, "

>not PatternCount(yourtextfield, "

  • Author

What I described would be in your "Field Definitions" using Validation by Calculation and would certainly stop a User from hitting return immediately when they did it. They they'd hit the OK button to run your script.

I was able to validate the global field but the user is not stopped until she exits the field (with tab or a mouse click somewhere)

Hi Paolo!

Yes, then you have it right!

You asked for a method to stop the insertion of carriage returns into the field. Immediate means during data-entry, as compared to having to run a script through your data later to clean it up. Your Users can't go to the next field until it's corrected! It will eliminate the need to run stripping scripts through your data and, if you search this Forum, the problems with carriage returns is major pain!

If what you want is to have your script run when the User hits enter, you'll probably need a plug-in frown.gif

LaRetta

Use a numeric field (eventually a global number field) for the data entry ... cannot be used in all circumstances but doesn't allow any carriage return

Create an account or sign in to comment

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.