dbTalk Databases Forums  

validating

comp.databases.filemaker comp.databases.filemaker


Discuss validating in the comp.databases.filemaker forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Ursus
 
Posts: n/a

Default validating - 08-04-2010 , 06:01 PM






FMP11.2a win

I have tried to create a validation for one field.
I want to restrict the use of certain keys, namely
all upperletters, all lowerletters, all numbers, space, left, right, back
and delete
I have create a custom function and a script.
All works well untill the user by accident hits the control-key and an other
key at the same time.
Some weird signs appear in the textfield. I should think these would get
blocked as well?

ControlKeyStroke:

Let(
keyCode = Code ( Get ( TriggerKeystroke ) );

( keyCode >= 97 and keyCode <= 122 ) or //all Lowercase letters
( keyCode >= 65 and keyCode <= 90 ) or //all Uppercase letters
( keyCode >= 48 and keyCode <= 57) or //Numbers
keyCode = 8 or
keyCode = 9 or
keyCode = 10 or
keyCode = 13 or
( keyCode >= 27 and keyCode <= 32 ) or
keyCode = 127 or //editing keys
keyCode = 20 //space
)

The script is very simple:
if [not ControlKeyStroke]
Exit Script [Result: False]
End if

The script is triggered by the field via a scripttrigger
(onobjectkeystroke):
All regular ABC etc comes through. All irregular ()[ : (etc) gets blocked.
But all irregular ctrl-o or ctrl-l (etc) return strange signs
--
Keep well / Hou je goed

Ursus

Reply With Quote
  #2  
Old   
Christoph Kaufmann
 
Posts: n/a

Default Re: validating - 08-05-2010 , 12:19 AM






Ursus <ursus.kirk (AT) ziggo (DOT) nl> wrote:

Quote:
FMP11.2a win

I have tried to create a validation for one field.
I want to restrict the use of certain keys, namely
all upperletters, all lowerletters, all numbers, space, left, right, back
and delete

All regular ABC etc comes through. All irregular ()[ : (etc) gets blocked.
But all irregular ctrl-o or ctrl-l (etc) return strange signs
Just two thoughts (i.e. no testing, no experience):

- Use the filter function in the auto-enter options
- In the script, you might try get ( AciveModifierKeys )
--
http://clk.ch

Reply With Quote
  #3  
Old   
Howard Schlossberg
 
Posts: n/a

Default Re: validating - 08-05-2010 , 12:14 PM



On 8/4/2010 4:01 PM, Ursus wrote:
Quote:
FMP11.2a win

I have tried to create a validation for one field.
I want to restrict the use of certain keys, namely
all upperletters, all lowerletters, all numbers, space, left, right, back
and delete
I have create a custom function and a script.
All works well untill the user by accident hits the control-key and an other
key at the same time.
Some weird signs appear in the textfield. I should think these would get
blocked as well?

It sounds like you need to trap for Get ( TriggerModifierKeys ) at the
top of your case statement, to Exit Script [false] if it's greater than 2.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Howard Schlossberg
FM Professional Solutions, Inc. Los Angeles

FileMaker Certified Developer
Associate Member, FileMaker Business Alliance

Reply With Quote
  #4  
Old   
Ursus
 
Posts: n/a

Default Re: validating - 08-06-2010 , 11:54 AM



Which seems very logical, but doesn't work. And I can't figure out why. I
will re-evaluate the set up, because there are also custom menu's involved
here where I have disabled going into an other view. It seems by re-enabling
the view menu (so ctrl-l etc is now back again) I at least can trap for ctrl
with l,b,f,u. But other combinations stil result in strange signs. When I
switch to default menu most problems are solved. But I really want to
restrict access.

So switched back to default menu. Added the TriggerModifierKeys check. But
there are strill problems. ctrl-p still opens the print dialog.

Now I discovered something else which I thought didn't have part of the
problem. But has. The field opens within a new layout, on top of the
old-one. Which I have made modal by halting the scipt. But the modal gets
lost because of the script which is triggered and ends with an exit[false]
when a modifierkey is used.

The field is part of a hot-search so I thought to update while typing, but
it seems I have to let that go.

Thanks for your time and trouble. I will put my thinking cap on and
hopefully will have found a solution after the wekend.

--
Keep well / Hou je goed

Ursus


"Howard Schlossberg" <howard (AT) nospam (DOT) fmprosolutions.com> schreef in bericht
news:i3erhc$m5d$3 (AT) news (DOT) motzarella.org...
Quote:
On 8/4/2010 4:01 PM, Ursus wrote:
FMP11.2a win

I have tried to create a validation for one field.
I want to restrict the use of certain keys, namely
all upperletters, all lowerletters, all numbers, space, left, right, back
and delete
I have create a custom function and a script.
All works well untill the user by accident hits the control-key and an
other
key at the same time.
Some weird signs appear in the textfield. I should think these would get
blocked as well?


It sounds like you need to trap for Get ( TriggerModifierKeys ) at the top
of your case statement, to Exit Script [false] if it's greater than 2.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Howard Schlossberg
FM Professional Solutions, Inc. Los Angeles

FileMaker Certified Developer
Associate Member, FileMaker Business Alliance

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.