I have a search field, a user types his customer number in it.
I want to when a user types his customer number and press inter-script run.
how can I do this work? I use on object keystroke but when I want to type number script run!
See the example in the help file; you need to detect what keystroke the user is using and use an IF to run your intended script only when the user hits enter or return:
FileMaker Pro 15 Help
Also; you didn't answer all the questions in the original thread. https://community.filemaker.com/thread/173104
There are other ways to achieve this that don't rely on the keystroke event.
can you give the true script to me? because user type phone numbers and the
phone number didn't repeat.
Use the script in the example, modify it for your purpose. If it doesn't work post your script here so that we can review. You can't just ask people to do your work for you. This forum is to help you get better at what you do; not to do the work for you.
I know sir this is not your business but just one time I see that then I
can learn it
You don't want the script to run on every keystroke, you only want the script to run when user is done with typing in the field. Think !
Understanding and using Script Triggers | FileMaker
Sure sir I want after user typing press enter and script run!
Just this time? Or just like all the earlier times?
In the Inspector check these boxes
Then use an OnObjectExit script trigger to trigger the script.
As mentioned in the other thread; this is one of the options. But is not the best option if you don't want your logic to run always and you'd rather have your logic run only if the user changed something in the field.
But before we can help you more, you need to be able to define what exactly you want to see happen under what different circumstances.
In this layout, after I type the number then press enter to run the script and find who is this phone
You said you're using OnObjectModify. That will run on every keystroke.
If you only want the script to run when you hit Enter, do not use OnObjectModify -- instead, try OnObjectValidate, OnObjectSave, or OnObjectExit. Each has a slightly different behavior, but any one of them might work for your purpose.
As I said first I type number then press enter to run script.
I've attached a small sample file. Hope it helps.
The sample file allows a user to enter a Return in the search field. The field should be set to go to next field when a Return is entered.
Good catch, attachment is updated.
Retrieving data ...