Jump to content

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


 Share

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?

1279701483_SearchFieldandbutton.png.afd80f2b0d7ba15ca70e5b7a217901d6.png

Thanks in advance.

Link to comment
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 comment
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 comment
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 comment
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
 Share

  • Similar Content

    • By V8S
      A small number of international remote workers require access to specific customer records that they should work on. Each worker has a code number and customer records are tagged with their code number accordingly.
      For years I have used a complex system of restricted privileges and scripting to hide the thousands of other records from these users. User experience is VERY slow.
      As suggested on one of the Filemaker forums, I am trying to implement a new system using a CONTROL table of customer IDs linked via a relationship to the CUSTOMERS table.
      CONTROL TABLE
      CustomerID Control_Code 123 UserA CUSTOMERS TABLE
      CustomerID Control_Code Name Address 123 UserA Mr Joe Bloggs 456 Main Street  
      A layout based on the CONTROL table shows fields from CUSTOMERS. The user can navigate their customer records without the performance overhead of loading thousands of customer records they shouldn't access. This is much faster.
      When UserA logs in, a global list variable sets which code(s) they can access.
      User $$AccessibleControlCodes UserA X
      Y
      UserB Z UserA should see only records in the CONTROL table records with a Control_Code of either "X" or "Y", but not "Z".
      A privilege restriction on CONTROL::Control_Code works. If I show all records, UserA can see X and Y records. Z records show "No Access".
      not IsEmpty(FilterValues ( Control_Code ; $$AccessibleControlCodes )) It would be annoying for UserA to have to flip through dozens of "No Access" records, so I still need to limit the visible records with a Find.
      Sadly, Find does not work at all on the layout. Doing any Find on any field always returns no results. Even though I am logged in as UserA and can see the X and Y records, trying to do a find of those same records doesn't work.
      I imagine this is a product of the privilege restriction but I can't figure out another route to take.
      I feel it would be inelegant to build separate CONTROL tables for each user. This would probably work, but I have multiple portal relationships for each control table and would need multiple scripts, multiple layouts, etc If we added remote workers, it would be a nightmare.
      Ideas please?
       
       
       
    • By Spidey
      Hi, 
      I have Filemaker 19 and have a calendar on the layout. My question is I don't want to have events on the calendar. Instead, I want to display orders and some of the information. Is there a way to do it? Thanks.
      calender.fmp12
    • By OneRedmouse
      Hi Everyone
      My database has just developed a strange issue after working fine for years and months after updating to FM19
      Mac M1 Big Sur 11.4 FM 19.2.114
      I go to a set of records (e.g. Invoices or Bills)
      I do a find for a company 
      X number of records comes up
      If I step through the records using the default chevrons (top left) I step through the records without issue
      However if I click the slider to go from the first found record to the last the records do not change. The record will go from 1 to (say) 25 but it will still show record 1. The chevrons work up to a point randomly changing the record displayed but not changing the slider or the record
      Has anyone seen this before?
      Thanks for your help in advance...
    • By Ismail AlAbdulmohsen
      Hello; how can we interface between FileMaker Pro Apps and cash machine from Banks so when making invoice the amount required will be sent to the machine and buyer will need to insert bank card and password then will be authorized.
      Thanks
    • By bgscott
      I have a field, item ID, set to auto enter a serial number and validation set to not empty and unique.  If the serial number entered is not unique I do not get an error message when exiting the item ID field.  If I turn off auto enter serial number and manually enter a non unique item ID, I do get an error message when I exit the field.
      With auto enter a serial number turned on I only get the non unique error message when I commit the record.  I would like to get the error message when exiting the field when auto enter a serial number is turned on
      Any suggestions?
×
×
  • Create New...

Important Information

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