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.

Script step to prevent field editing

Featured Replies

I just have one quick question... Is there anyway to change whether a field can be edited or not through a script step?

Here's the situation: I have 1 field with radio buttons Yes/No. If that field is yes, then i don't want the user to be able to enter anything in my second field. If that is no, then i do want my user to be able to enter information in the second field. :P

Thank you

Edited by Guest

You could use the filemaker validation to check if the value is no:

Go into define database, choose your second field, click options, go to the validation tab, choose validated by calculation and in there put in FirstField = "No"

I think that Genx wished to say:

FirstField = "Yes"

BTW if you don't like the FM message with "OK", "No" and "revert", you can set the option of autoenter a calc:

Case(

FirstField = "Yes"; secondField;

""

)

There is even a better way: the invisibility trick.

  • Author

Thanks for the suggestions

i think that might work... what invisibility trick?! :shocked:

Edited by Guest

  • Author

The Case statement in the auto enter value worked. I had tried something like that earlier with an If statement, but i think my syntax was wrong.

anyways, thank you both!

check for "visibility" here

See attached sample re invisibilty trick.

Change field 1 to yes and no to see result

HTH

Phil

visibility.zip

Sorry Daniele If my post seems to trample across yours in an abrupt manner

I didn't mean to be rude. I was putting together the sample and didn't see that you had already replied

Phil :idot:

Don't worry !

Better more than less.

Well, i meant no because they wanted to be able to enter a value in the second field if the value in the first field was no... i.e. the value was valid in the second field if the first field was no not yes.

have I misreaded the post ? or Mushi edited it ?

Now you are right !

... no it said that before, i had to re-read it the first time i saw it aswell seeing as things like this are usually validated as yes.

Interesting. Can this be extended to allow/disallow editing various fields based on a status value? E.g. If a record has a status of "a" you can edit any field, if it has a status of "b" you can edit a subset of the fields, if the status="c" you can edit a different subset, if the status="d" you can not edit any of the fields, ...

(What I want is script control over field behavior.)

Yes but it has to be done in each subset. If you want script control then have a look at EventScript but you still have to enable in each individual field.

BTW if you don't like the FM message with "OK", "No" and "revert", you can set the option of autoenter a calc:

Case(

FirstField = "Yes"; secondField;

""

)

Keep in mind that this technique does not actually prevent the field from being edited, rather, it prevents the field from holding any data when the condition is not met. So, if you were to use this with a status field that toggled between "edit" and "hold", whenever "hold" was selected, the contents of the field would be wiped out.

You would need a third 'storage' autoenter field to use this technique for just editing:

Storage:

Case(

FirstField <> "Edit"; secondField;

Storage

)

SecondField:

Case(

FirstField = "Edit"; secondField;

Storage

)

Edited by Guest
added workaround

Plus, i can almost guarrantee you that if you do it this way you will get phone calls from your users asking "why is my data being wiped" "your database is broken" or my favourite "i've spent the past hour putting data in a field over and over again and it keeps wiping it" ... not that i actually get these comments, but trust me, if you wipe their data, you will, much better to tell them why its occuring using validation rather than wiping whatever they put in the field.

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.