Jump to content
Server Maintenance This Week. ×

Conditional Formatting - trigger on field modification


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

Recommended Posts

Greets, all:

I have a form where users are required to fill out a minimum set of fields for the record to be valid; once they do, a calculation within a Button Bar button changes its text from Incomplete to Complete. That works fine.

What's problematic (to me) is that as the user enters text in the last field that requires data, the aforementioned button won't change state until the record is committed. I tried setting the Script Trigger in that last field to OnObjectModify or OnObjectKeystroke, but with every keystroke FileMaker barks "Before typing, press Tab or click in a field, or choose the New Record menu command," even with the Commit Record's dialog is set to OFF.

Is there a Script Trigger or calculation that will change that button's state while the user is typing so they won't see any system messages? Although inelegant, I could put a statement (or a tersely-worded button) on the layout that says, "Click anywhere when you're done entering data" so they manually commit the record-which will change the button's state--but if the button could change state after the user enters at least one character into the last required field, that'd be preferable.

 

Cheers,

Rich

Link to comment
Share on other sites

9 minutes ago, WF7A said:

the aforementioned button won't change state until the record is committed

I don't think that's an accurate statement. I believe the button will change state when user exits a modified field, whether by committing the record or by tabbing out of the field or by clicking into another field (neither of which commits the record). 

You haven't told us what your calculation is. I presume it is based on IsEmpty ( YourField ). This will keep referring to the value stored in the field, until user exits the field. To make the button change as soon as the field is modified, you need to change the calculation so that it also tests for something like:

Get (ActiveFieldName) = "YourField" and not IsEmpty ( Get (ActiveFieldContents) )

and add a script triggered by modifying the field that refreshes the button object.

--
Of course, in the final version you will want to remove the hardcoded field name.

 

Link to comment
Share on other sites

Sorry for being dense, but I'm not getting it so I've attached a quick-'n'-dirty file which I think I coded correctly with your suggestion; if you insert any text into Field and commit the record, "Hi there!" will appear as text within the button. What I want to be able to do is enable the message in the button without committing the record, first, the reason being that users often forget to click elsewhere on-screen to commit a record so even though all the required fields are filled out, the button won't show its text until the record is committed.

 

 

Test.fmp12

Link to comment
Share on other sites

14 minutes ago, WF7A said:

What I want to be able to do is enable the message in the button without committing the record,

You have that already. Click into the field, type something (or delete what's already there) and press Tab. The button's label will change but the record will not be committed (you can see that in the Records menu the Revert Record… command is still available).

What you really want (I think?) is that the button's label change without exiting the field. This requires a little more work - as shown in the attached modified file.

 

 

Test2.fmp12

  • Like 1
  • Plus1 1
Link to comment
Share on other sites

This topic is 435 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
×
×
  • Create New...

Important Information

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