Skip to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Search problem in FMP 4.1

Featured Replies

Am currently producing an on-line searchable database using FMPro 4.1v2 and using FMP to serve the whole site. The server is a Mac (BW G3 350 runing OS 8.6).

Users are able to search for a list of records by entering any one or more of three parameters. A fourth parameter is permanently set by being a hidden input on the search page.

However if a search is made without putting in any user parameters the search returns all records which match the hidden parameter.

Although I understand why this is it means users get a list of about 800 records when by using one or more of the user parameters in addition the number of records returned will be no more than 30 or so.

What I want to do is produce an error to return an error page if none of the user parameters are entered.

Despite racking my brains and trying numerous ideas I have not yet come up with a solution.

Is such a situation possible using CDML or a script?

You could test for Status(CurrentError) = 400 before continuing and setting the extra parameter.

Set Error Capture [On]

Enter Find Mode [Pause]

Perform Find [ ]

If [status(CurrentError) = 400]

[color:"white"]__Enter Find Mode [ ]

[color:"white"]__Show Message ["No criteria was entered."]

[color:"white"]__Exit Script

End If

Modify Last Find

Set Field [fieldA, "extra parameter"]

Perform Find [ ]

If [status(CurrentFoundCount) = 0]

[color:"white"]__Enter Find Mode [ ]

[color:"white"]__Show Message ["No records were found."]

[color:"white"]__Enter Browse Mode [ ]

End If

Hi, B! Although I cannot give you the answer, I think what you want is a JavaScript validation. You can use JavaScript to make sure that a field has a value (not empty) before the form can be submitted. I used something similar to make sure a password field and the confirm password field had the same values or it rejected the form and would not submit. Unfortunately, I do not "know" JavaScript yet but it was easy enough for me to find a JS script for what I had wanted. You might be able to find what you need (or enough to modify as needed) in the posts or online at a scripts site.

I assume JS has "or" functionality to apply your requirement to any of the 3 search fields.

--ST

  • Author

Many thanks for the suggestion. It gets me part way in that the error can be used to display the error page I have provided. However I am having problems getting the extra parameter recognised in the Form I am using. Willl carry on and see if I can solve that part of the puzzle.

  • Author

Hi Queue

My solution after your suggestion was to use two scripts as one didn't work as it should thus:

Called by -Script.PreFind

Set Error Capture[On]

If [status(CurrentError)=400]

Exit Script

Endif

This calls my error page because of a hidden -Error call

Then called by -Script.PreSort

Modify Last Find

Set Field [FieldA,value]

Perform Find[]

It may not be good scripting but it works perfectly!

smile.gif

Perhaps it's a web thing. Glad you finally got it working though. smile.gif

Create an account or sign in to comment

Important Information

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

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.