Jump to content

Enter text in field & hit enter key to activate database search

Recommended Posts

New user

I have a "Search" script setup in one of my layouts, which works well but I'd like to refine it a little to make searching quicker and with less mouse clicks.

Currently, I have a field into which I enter a client name, and a "Search" button which activates a search throughout my database for any records containing this name. For the search to work I have to input the name (or a portion of it) into the "Search Name" field , and then click on the "Search" button.

What I'd like to happen is to enter the name into the field and then hit the enter key to activate the same search. Is this possible?


Thanks in advance.

Link to post
Share on other sites
Posted (edited)

Hi comment, thanks but I have no idea how to implement one of these script triggers and the Claris explanation is quite confusing.

From some of the online info I've been reading, sounds like I need to firstly "capture" the enter key inside a script, and then assign a script trigger to my "Search all records" script? I tried a few times, but I just keep getting the same message: "Before typing, press Tab or click in a field or choose the New Record menu command"

I've attached the script I found, which is assigned to the "Search" button.

Thanks for any further help.


Screen Shot 2021-05-02 at 11.47.23 AM.png

Edited by St3v1e
Link to post
Share on other sites
Posted (edited)
6 hours ago, St3v1e said:

sounds like I need to firstly "capture" the enter key

That is not necessary. The Enter key* exits the field - so you can use any one of the following script triggers:

  • OnObjectExit

  • OnObjectSave

  • OnObjectValidate

6 hours ago, St3v1e said:

and then assign a script trigger to my "Search all records" script?

You assign the script trigger to the field (or more precisely - to the field instance on the layout), not to the script.

(*) Note the difference between the Enter and the Return keys. If you want the Return key to trigger the script as well, you must assign it to go to next object (in the Data section of the Inspector). Or indeed move to the OnObjectKeystroke trigger - which would be overkill in this case, IMHO.


Edited by comment
Link to post
Share on other sites
Posted (edited)

Many thanks Comment - just assigned the script trigger "onObjectExit" . . . and tried it using the "Enter" key (was using the "Return previously), and it worked first time!

So now I'll follow your instructions to see if I can make it work using the "more commonly used) "Return" key.


 . . .  and that also worked!

Problem Solved!

Many thanks as always Comment.

Edited by St3v1e
Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Similar Content

    • By NickFaraday
      Hey everyone, 
      Just looking to see if anyone has come across a good solution to for this.  
      I have a set of records with multiple fields that I need to export to Excel, I'm exporting via script and everything works great with the exception of one of my fields "columns".   This field has a multi-line description.   When exporting, all carriage returns are stripped.   A quick google search turns up some solutions for exporting a single filed and preserving returns but not a group of fields with only one "column" needed the returns preserved.
      I'm on FM19 Server. 
      Is there a plugin that addresses this issue?
    • By bgscott
      I have an application where some of the related files will reside on removable media.  When sorting, a message box appears telling the user that the related file (which is not on the server) can not be opened (Not Found) and asks the user to locate it.  The related file may or may not be available on the removable media and is not needed for the purposes of the sort.
      Is there anyway to prevent this message from appearing?  Error capture on does not solve the problem
    • By ChrisOC
      Has anyone integrated Smartsheet with FileMaker using Claris Connect? I can get the basics set up and am able to create a Flow that will add a new record in FM when a row is added in Smartsheet.  However, I can't seem to figure out how to pass any column data from that row into the new FM record.  It does not give me the tags for any of the columns from my sheet, only high level parent and body tags.  What am I missing?  
    • By paulkivett
      My first try using a Server Side Script. I'm importing csv data which is on "This PC / Documents/CompPBM_checks.csv". I have tried every possible path, but still get missing file error. Options tried include
      file:ThisPC/FileMaker Server/data/documents/CompPBM_checks.csv
      $Import equals: Get ( DocumentsPath )&"CompPBM_checks.cvs"
      FM Server is hosted on AWS
    • By pixi
      Has anyone played with latest FMS Linux and LetsEncrypt-Certificates? 
      (How) does it work?
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.