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.

Ensuring Text enter contains only numbers

Featured Replies

Hi,

I like to check with you guys if there is any way to ensure the text that the user enter contains only numeric? I have no problem with the validation if the user enters a strign of alphabets but if he enters alphanumeric, i cant check for it.

You can validate a text field based on

Length(field) = Sum( PatternCount( field; 0 ); PatternCount( field; 1 ); PatternCount( field; 2 ); PatternCount( field; 3 ); PatternCount( field; 4 ); PatternCount( field; 5 ); PatternCount( field; 6 ); PatternCount( field; 7 ); PatternCount( field; 8 ); PatternCount( field; 9 ) )

Hi,

Why not

Length(TextToNum(Substitute(input;"0";"1"))) = Length(input)

I'm not sure, what you mean by "alphanumeric". Actually, if you check the validation option "Strict Data type: Numeric only" for the field, the user can't enter anything else but numbers (and a minus sign); make it strict, so he/she can't override the rule.

But maybe, you want to allow the user to entry anything, but want to store only the entered numbers. If your input field is of type number, you could use a calculation field c_onlyNumbers = "TextField" and format its result as number too. This will allow the user to enter anything, but the calculation field will only contain the numbers and ignore any characters (except a dash as a minus).

Yeah, I figured you would use that one. I've been working heavily on another project, so I decided to take the easy copy/paste/braindead route this time. laugh.gif

Well,

Seeing as qwerty' is listed as using 7, can we not use

Filter ( The Field To Filter ; "01234567890,.")

This could be placed on the field as an auto enter calc with the Do Not Replace Existing Value For Field (if any) turned off. Then, no matter what the user enters, the field will filter all extraneous data out.

Saves extra calc fields.

It's just a thought.

Indeed, FM7 makes this sort of thing much easier. The filter function could also be used as validation, in case there's need to prompt users to re-enter it correctly, rather than to assume that any numeric characters entered must be the right ones... (In some cases, if users enters data with letters included, it likely means they're not attending to the right data: Library of Congress number rather than ISBN, say...)

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.