Jump to content

Conditionally prevent edit of field contents


This topic is 2009 days old. Please don't post here. Open a new topic instead.

Recommended Posts

This must be easy to do, but I just can't think it through.

Suppose Field#1 contains the value "Yes".

Then I want to allow a user to edit "Yes" to "No".

But if Field#1 already contains "No", then I want to prevent this being changed to anything else.

I'd like to do this with minimal overhead - preferably no Script Triggers or buttons or dialogues - it should be seamless. i.e. if the user overwrites "No" with "Yes", it should revert back to "No" with no dialogue.

Is this possible ?

Thanks for your time.

Link to post
Share on other sites

I feel like this is a very common desire, but Filemaker doesn't have an easy way to accomplish this...

 

Is your case simply that one field Yes/No field?? You should just use some script triggers...Store the current field value on field enter To a $$Global Variable or a global field. Then, on field exit, have another script trigger, if Previous Value = "No" and Field1Value = "Yes"; Field1Value = "No". Each script would be a couple of lines. If you wanted you could show a dialog sending a message about reverting the field.

Link to post
Share on other sites

@hbrendel....could we see your 'easy way'?  I tend to overcomplicate things.

I came up with this script trigger for OnObjectModify, Script parameter is just the field

 

Set Variable [$$a; Value:Get(ScriptParameter)]

If [isEmpty ($$a) or $$a="Yes"]

Else

     Set Field [Table::field;"No"]  // Yes/No field

End If

Set Variable [$$a; ""]

 

I put this on a radio button set.  In this field I use RayBaudi's (where's he been?) much posted:

GetValue (Self; ValueCount (Self)) as an auto enter calc, "do not replace..." unchecked, to prevent shift+clicking both buttons

Link to post
Share on other sites

I use 'Hide Object When'.

Make two instances of the same field, One is editable, the other not. Give them complementary conditions for hiding and place them on top of each other.

The non-enterable field is hidden when the value not = "No".

The enterable field is hidden when the value = "No".

Easy in FM 13...

  • Like 3
Link to post
Share on other sites
But if Field#1 already contains "No", then I want to prevent this being changed to anything else.

I'd like to do this with minimal overhead - preferably no Script Triggers or buttons or dialogues - it should be seamless. i.e. if the user overwrites "No" with "Yes", it should revert back to "No" with no dialogue.

 

I think the question of why you want this should come before the question of implementation costs. If this is a matter of data integrity, then it should be solved at the data layer, not by using any layout measures (script triggers, conditional formatting, etc.).

 

 

Are you really using version 7 as indicated by your profile?

Link to post
Share on other sites

This worked perfectly for my case, thank you! Very cool, I hadn't seen Hide Object When..

 

I use 'Hide Object When'.

Make two instances of the same field, One is editable, the other not. Give them complementary conditions for hiding and place them on top of each other.

The non-enterable field is hidden when the value not = "No".

The enterable field is hidden when the value = "No".

Easy in FM 13...

Link to post
Share on other sites

This topic is 2009 days old. Please don't post here. Open a new topic instead.

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
  • Similar Content

    • By troi
      Updated script triggering plug-in for FileMaker Pro 17 adds script triggering via a URL.
      Alphen aan den Rijn, the Netherlands, April 23, 2019–Troi today announced the immediate availability of Troi Activator Plug-in 5.0 for FileMaker Pro 17.
      What is Troi Activator Plug-in?
      Troi Activator Plug-in is a very powerful tool for triggering scripts remotely. All from within FileMaker you can:
      trigger a FileMaker script on a different computer (remotely) trigger a FileMaker script over internet use the built-in security to prevent unauthorized triggering send a number (e.g. a record ID) and a long text with the trigger start and stop listening for remote trigger messages with one script step communicate with databases in different FileMaker versions or even runtimes Except from remote triggering you can also use the Activator Plug-in for:
      triggering a script on a specified date and time scheduling events which trigger any script you want running a script from any FileMaker calculation, for example a tooltip calculation validating fields on exiting a record with a custom script suited to your specific needs What is new in version 5.0?
      Troi Activator Plug-in 5.0 is compatible with FileMaker 17 and has the following new functionality:
      Tested and made compatible with FileMaker Pro 17.0.4. Added script triggering via a URL (using the GET HTTP method) on macOS and Windows. You can now trigger a script with a URL like this:
      http://www.example.com:54242/triggerscript.html?yourText=someText
      You can also specify an (optional) password in the URL and add whether you want to wait for a response. In the triggered script you can specify the response text with the new Actr_SetHTTPResponse function or Set HTTP Response script step. The Activator Web Server functionality, including the Image Upload Server functionality, is now also available on Windows. (Windows) Added code signing to the plug-in for Windows. (On macOS code signing was already added in version 4.5). The plug-in now indicates if an external script step is compatible with a product. The step is shown in grey if it is incompatible for that product (for example for iOS) in the script editing pane (center) and the script steps pane (right). (macOS) Prepared the plug-in for notarization: the plug-in can now be added to a runtime, to create a hardened FileMaker runtime app which can be notarized by Apple. Notarization gives users more confidence, as the runtime has been checked by Apple for malicious components. Version 5.0 also has the following changes and improvements:
      IMPORTANT (macOS only) The minimum supported FileMaker version is now FileMaker Pro 14. Also the minimum supported Mac OS version is now OS X 10.9 (Mavericks). You can keep using v4.5.1 for older versions of FileMaker Pro or Mac OS X. (macOS) The plug-in no longer has the 32-bit code included. Updated the EasyInstallTroiPlugins.fmp12 file, it can show additional error information from Get(LastExternalErrorDetail) when it is available. The EasyInstallTroiPlugins.fmp12 file can also run a test registration script for a plug-in after you have installed it on FileMaker Server. Updated the example files for FileMaker Pro Advanced 17 and made small corrections to the user guide. Pricing & Availability
      A fully functional demo version of Troi Activator Plug-in 5.0 is available on the Activator Plug-in page.
      Licenses cost US$ 89 per user. Details on developer licenses and multi-user discounts can be found on the Activator Plug-in page. You can order licenses from our shop.
      Upgrade information
      Version 5.0 needs a new registration. The upgrade is free for users who bought a license for Troi Activator Plug-in on or after September 4, 2017. Eligible users will be sent a new registration. Contact us if you have not received yours after April 26, 2019.
      Upgrades from licenses bought before September 4, 2017 are available from US$ 49 per user. Upgrade prices for other licenses can be found in the shop. You can order upgrades there.
           
    • By Scott Pon
      Environment: FM13 with FM13 Server, mix of Windows 7 and 10.
      Is there a way to set a script trigger on if this portal row is new? IE, a script to run if this new child/portal record is new.  
      We have a parent record, and portal to Children records.  The children records have 2 fields: Profile Name and Process type.  Our user would like to enter a new child record (profile name and process type).  if the process type already exists, we will need to archive the existing record (matching the profile type).  There is more bI want to start with this first.
      I see script triggers to the layout "OnRecordCommit", but no similar script trigger for portals.  Any ideas on how to handle this?  Or am I going to have to add a button to go to another screen to accomplish this?
      Thanks.  I hope i gave enough info for you to help me.
       
    • By dav1089
      Hello,
      I want to create a script trigger which opens a layout based on account name ,create new record and put cursor in first field of the new record
      Now, I was able to direct user to specific layout and also created new record using New Record/Request function but somehow it doesn't put cursor in the first field , instead it selects whole record .
      Note: I also have script triggers attached to first and second field which runs on exiting the fields. (I don't think they affect anyways , but just mentioned to give idea)
    • By CRexen
      Hello everyone
       
      I am currently working on a database, which HR-Managers can access via WebDirect using login-information, to accede or resign their employees.
       
      I have made 6 possible option types for the HR-employees to enter data into, set by an unique ID, but with the use of the same fields.
       
      So...
       
      X fields with option type 1 (Accede)
      Y fields with option type 2 (Resign)
      Z fields with option type 3 (Maternity leave / leave)
      .. Etc. 6 option types in total.
       
      Now, based on my project description, a couple of the fields will have to be validated / not empty, which the HR-manager is prompted to enter before the record can be committed.
       
      Now, I am aware of FileMaker has it's own Field Validation, but I think the built in feature is bonkers..... (Sorry FileMaker..) 
       
      Therefore I was thinking of making a script to each of the different fields, which needs validation, and is this even a good solution
       
      Question one; how do I do this, the most easily? Is it possible?
      I have 8 required fields for validation, fields are global.
       
      Fields such as; Company Name, HR-manager name, HR-manager e-mail, employee SSN, employee name, employee surname etc. 
       
      I don't want the scripts to interfere with the other option types ( X, Y, Z ) which each is set by an unique ID, as well as fields, although the fields used in these option types are from the same table.
       
      Please see attached images of my setup.
       
      Hope you can help me, for the best possible solution.
      If you need more information, let me know.
       
      /Cheers
       
      P.S. The language/text on the layout is Danish, although shouldn't be considered an issue for understanding my problem.



    • By Dana G
      Purpose:  To capture the contents of a field before it is changed.  Compare the before to the after.  Highlight the after and screen capture then export.
       
      I can't get past the first sentence and it's getting frustrating because it seems extremely simple.
       
      1 Field:  OnDeck_t (text)  -  The OnDeck_t field data = On
      2 Field:  OnDeck_before (Where I want to capture the OnDeck_t before it's changed)
       
      I have an OnObjectEnter script trigger on the OnDeck_t field that runs this script:
      Set Field By Name [substitute (Get (ActiveFieldName); "_t"; "_Before"); Get (ActiveFieldContents)]
       
      If I do this it works fine.  (But I don't want it hard coded.  I will be using it for all the fields on the layout):
      Set Field [OnDeck_before; Get (ActiveFieldContents)]
       
       
      I have divided the Substitute (Get (ActiveFieldName); "_t"; "_Before") and Get (ActiveFieldContents) into separate lines in Data Viewer and both return expected results.  Why doesn't it work when it's part of a 'Set Field by Name' script step?
       
      Thanks.
  • Who Viewed the Topic


×
×
  • Create New...

Important Information

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