Hello,
I search if something exist to check what is entered inside a field on screen like a format template.
For some fields I would like just numbers, others just characters and so ...
Some languages have input values like "####" means only 4 numbers or "##/##/####" means a date.
Thanks for help,
Cheers, Fabrice
how to check field format during entry
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
how to check field format during entry
Last edited by fmuller on Sun Apr 11, 2010 8:36 pm, edited 1 time in total.
Re: how to check field format during entry
Grüezi Fabrice,
ca va bein?
Put this into the fields script to allow only numbers as input including prefix -+ and decimal delimiter which is comma in my example!
Same for non numeric input:
... if tKey is in "abcdefghijklmnopq..." ### etc...
Hint: "A = a" if you do not "set the wholematches to true" before you compare something!
But you can check the field after the input and format the content accordingly.
Use the "closefield" handler to do so and maybe the "format" function.
Example: User entered a number (1) but we woul like to see the field formatted like 1.00:
Hint: the engine always uses english decimal formatting 1.00, so here in my scripts in germany I do:
...
replace "." with "," in tnumber
...
Before I put the string back into the field.
Of course there is a lot of errochecking needed, like empty fields etc...
Hope that helsps!
Best from germany
Klaus
ca va bein?

This is quite straighforward!fmuller wrote:...For some fields I would like just numbers, others just characters and so ...
Put this into the fields script to allow only numbers as input including prefix -+ and decimal delimiter which is comma in my example!
Code: Select all
## We check the typed character BEFORE we put them into the field!
on keydown tKEy
if tKey is in "1234567890,-+" then
## Typed character OK, let it pass
pass keydown
end if
end keydown
... if tKey is in "abcdefghijklmnopq..." ### etc...
Hint: "A = a" if you do not "set the wholematches to true" before you compare something!
THis is not built in into Rev unfortunately.fmuller wrote:Some languages have input values like "####" means only 4 numbers or "##/##/####" means a date.
But you can check the field after the input and format the content accordingly.
Use the "closefield" handler to do so and maybe the "format" function.
Example: User entered a number (1) but we woul like to see the field formatted like 1.00:
Hint: the engine always uses english decimal formatting 1.00, so here in my scripts in germany I do:
...
replace "." with "," in tnumber
...
Before I put the string back into the field.
Code: Select all
on closefield
put me into tnumber
put format("%1.2f",tnumber) into me
end closefield
Hope that helsps!
Best from germany
Klaus
Re: how to check field format during entry
Hi Klaus,
Alles gut und dich, hast du ein schönes Wochenende gehabt ?
I switch to English, it's easier
Thanks a lot for your solution I will try it.
Cheers from Switzerland, Fabrice
Alles gut und dich, hast du ein schönes Wochenende gehabt ?
I switch to English, it's easier

Cheers from Switzerland, Fabrice
Re: how to check field format during entry
FieldFormatter is now available...
http://www.FlexibleLearning.com/fieldformatter
It does exactly what you are asking for.
Hugh Senior
http://www.FlexibleLearning.com/fieldformatter
It does exactly what you are asking for.
Hugh Senior
The Flexible Learning Company
• ChartMaker: www.FlexibleLearning.com/chartmaker
• ControlManager: www.FlexibleLearning.com/controlmanager
• The Scripter's Scrapbook: www.FlexibleLearning.com/ssbk
• DatePicker: www.FlexibleLearning.com/datepicker
• ChartMaker: www.FlexibleLearning.com/chartmaker
• ControlManager: www.FlexibleLearning.com/controlmanager
• The Scripter's Scrapbook: www.FlexibleLearning.com/ssbk
• DatePicker: www.FlexibleLearning.com/datepicker