6 Replies Latest reply on Nov 4, 2011 10:57 AM by philmodjunk

    field trigger



      field trigger


      by default when i perfom enter on a field i have a new line, i want to change the behaviour (unsing trigger?):

      when i enter the field i want to exit it and perform a search script.


        • 1. Re: field trigger

          Hi Fagreement,

          When you are in browse mode, performing [enter] will indeed create a second line but when in Find mode, hitting [enter] will perform your find.  So if you want to enter the field and when you exit, it perform the find, be in Find mode when you enter the field. 

          If the field the User will be entering the find criteria is GLOBAL, then they would enter their criteria in browse mode.  If this is your situation and you want to have trigger perform a find when they hit [enter] then it might look like this, assuming the search field is global text called gSearch:

          User enters data into gSearch and hits enter.  Script trigger attached to gSearch fires the following script:

          Enter Find Mode [ uncheck pause ]
          Set Field [ fieldToSearch ; gSearch ]
          Set Error Capture [ On ]
          Perform Find [ ]
          If [ not Get ( FoundCount) ]
          Show Custom Dialog [ "No records found" ]
          ... do whatever if no records
          ... do whatever with the found records
          End If

          • 2. Re: field trigger

            "enter" can mean different things depending on your Operating System. On Windows keyboards, both the RETURN button on the Qwerty part of your keyboard and the ENTER key on your numeric keypad are labeled "enter". In filemaker, the field behavior settings in the inspector let you choose what will happen when you press Return (Qwerty Enter in windows) and what will happen when you press Enter (key on the  numeric key pad).

            Thus you can set field behavior for this key to exit the field and then you can use the OnObjectExit trigger to perform a script. However, this setup means your script also runs if you exit the field by other means such as clicking a part of your layout. Thus, it's sometimes useful to use the OnObjectKestroke trigger and check each key pressed to see if it was the enter ( code ( Get ( TriggerKeystroke ) ) = 10 ) or return ( Get ( TriggerKeystroke ) ) = 13 ) key and then perform the find only when that specific key was pressed.

            • 3. Re: field trigger

              thanks it works.


              now, is there a way to not show the followin message of filemaker when a user enter a key on the keyboard...?

              "Before typing press tab or click in a field..."

              • 4. Re: field trigger

                If the cursor is in the field, you should not get this message.

                If this happens because of your OnObjectKeystroke triggered script, you can end the script with Exit Script [False] and the "enter key action" will not be processed by Filemaker.

                • 5. Re: field trigger

                  it happen when in browse mode and the user type a key, i don't want from filemaker to show me this message

                  • 6. Re: field trigger

                    Using OnLayoutKeystroke to trigger this script will eliminate this message:

                    If [ IsEmpty ( Get ( ActiveFieldName ) ) ]
                       Exit Script [False]
                    End If