Jump 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.

Featured Replies

Hello to all,

I have a database and I want to block modification of the fields if a given variable is not = 1. can i do this?

i have create a button that change the variable from 0 (non modifiable) to 1 (modifiable) but if the variable is 0 i want that fields are only reading.

i use Filemaker Pro 15 for mac

thanks

Andrew

Hi Andrew

You can set OnObjectModify (and OnObjectKeystroke if you like) Script Triggers on the fields that you want to lock, to run a script along the lines of the below. That will reject the input if the $$lockvariable is set to 0

If [ $$lockvariable = "0" ]
Exit Script [ Result: 0 ]
End If

As an extension, in one of our solutions we show an error panel, that is just a rectangle with some text in it that is the frontmost layer of the layout, and we use an OnTimer script to hide it after a couple of seconds. This explains to the user why their input is not appearing, but doesn't require them to acknowledge it.

If [ $$lockvariable = 0 ]
Set Variable [ $$showInputError; Value:"Y" ] // the $$showInputError variable is used to show/hide the rectangle with text in it
Install OnTimer Script [ “Clear Input error”; Interval: 2 ]  // this script sets $$showInputError back to 'N' after 2 seconds, which hides the rectangle again
Refresh Window
Exit Script [ Result: 0 ]
End If

The 'Clear Input Error' script needs to both change the variable $showInputError back to "N" and stop the OnTimer script otherwise it keeps running every 2 seconds. That script looks like this.

Set Variable [ $$showInputError; Value:"N" ]
Refresh Window
Install OnTimer Script [ ]

Hope that helps

Edited by rwoods

  • Author

Hello. I tried to follow your example and I managed to set up the script.

Thanks again.

11 hours ago, pomilpetan said:

I want to block modification of the fields if a given variable is not = 1.

The simple method would be to allow users to edit records only when the variable = 1 (in users privilege set). However, I would ask why you need this - because any limitation that depends on the value of a variable can be circumvented by the user.

  • Author
12 hours ago, comment said:

The simple method would be to allow users to edit records only when the variable = 1 (in users privilege set). However, I would ask why you need this - because any limitation that depends on the value of a variable can be circumvented by the user.

The person who asked me the database has noticed that often unintentionally wrote in the fields instead of doing a search or changed field by deleting the content. so at least you can only read without changing the data unless authorized to do so.

Create an account or sign in to comment

Important Information

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

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.