June 24, 200421 yr 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.
June 24, 200421 yr 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 ) )
June 24, 200421 yr 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).
June 24, 200421 yr 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.
June 24, 200421 yr 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.
June 24, 200421 yr 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