1 2 Previous Next 16 Replies Latest reply on Apr 2, 2012 12:48 AM by ClaudiuNemes

    enable disable fields

    ClaudiuNemes

      Title

      enable disable fields

      Post

      Hi there,

      I have a question regarding enabling disabling fields.

      I have a radio button set with values from a values list regarding Financing Source:

      FS1, FS2, FS1+FS2

      and two disbursement repeating fields (number, 12)

      DS1 and DS2

      What I want is that on radio button select:

      rbSelect FS1 - disable the field DS2
      rbSelect FS2 - disable the field DS1
      rbSelect FS1+FS2 - enable both fields DS1 and DS2

      Many thanks for your time,
      Looking forward to hear news from you,
      Yours,
      Claudiu

        • 1. Re: enable disable fields
          philmodjunk

          Note: Repeating fields are rarely the best option for a FileMaker database design. Usually a table of related records provides far more flexibility to what you can do with the data entered into the repeating fields.

          An OnObjectEnter script trigger can be used to perfrom a script that denies entry into the field if the value in rbSelect indicates that access should not be permitted. The script can test the value of the field and then use go to field, go to object or go to next field to put the cursor somewhere else on your layout.

          • 2. Re: enable disable fields
            ClaudiuNemes

            Hi Phil,

            Many thanks for your reply. So you suggest to build a new table called let's say "Disbursements" and to create 24 fields (DS1-1...DS1-12 and DS2-1...DS2-12) instead of having 2 (DS1, DS2) with a 12 repetition.

            I was discouraged by the fact that we have 4 years of studies, meaning 96 separate fields (YIDS1-1...YIDS1-12 and YIDS2-1...YIDS2-12 to YIVDS1-1...YIVDS1-12 and YIVDS2-1...YIVDS2-12).

            True that in past I use to have problems while exporting and importing repeating fields (only first value is exported) to excel format. I use in those cases .bas and latelly .csv type and import into excel.

            I have noticed that I could use OnObjectEnter but I simply could not figured out how to do it since I could not find any enabled/disabled function for fileds nor any discussions on forums. I simply need this feature in a single layout (form view) for data operators in order that they don't miss the fields when entering data. If you could give me some guidance I'll much appreciate this.

            Many thanks for your time,

            Yours,

            Claudiu

            • 3. Re: enable disable fields
              philmodjunk

              Many thanks for your reply. So you suggest to build a new table called let's say "Disbursements" and to create 24 fields (DS1-1...DS1-12 and DS2-1...DS2-12) instead of having 2 (DS1, DS2) with a 12 repetition.

              More likely I'd use a related table with ONE field for storing this information and then additional fields that store date information such as the month to identify the appropriate time period.

              Keep in mind that this is a separate issue from the question of controlling access to the fields. I've tried to give you a short term fix for your existing set up while suggesting a long term change that produces a structure that makes it easier to work with the data currently stored in repeating fields.

              I was discouraged by the fact that we have 4 years of studies, meaning 96 separate fields

              This would not be a change to make without carefully maping out how to make the change and keeping back up copies so that you can try again if your first attempts to make this change mess up your data. It can be done, however. When importing data from one FileMaker table into another, FileMaker will ask you if you want to split the data in a repeating field into separate records. This often greatly simplifies the process for restructuring data from a repeating field into separate related records. There are also ways to use scripts and Replace Field Contents to automate the processes needed to make such a change.

              If you could give me some guidance I'll much appreciate this.

              I'm not sure what guidance to offer. I don't quite understand where it is that OnObjectEnter creates a problem for you. Can you give a more detailed description of where you encounter trouble when writing the script for this script trigger?

              • 4. Re: enable disable fields
                ClaudiuNemes

                Hi Phil,

                Unfortunatelly I don't know how to write the script that could produce a result like this one here:

                http://www.claudiopolis.org/rb/rb_conditional.html

                I came from Flash AS and JS but in FM I could not find functions that could produce this result.

                "Back to Initial State" button will not exist in FM, this is here just to replicate the intial state.

                Yours,

                Claudiu

                • 5. Re: enable disable fields
                  philmodjunk

                  In Filemaker this comprises two tasks:

                  1) Providing a visual cue that the fields are not enabled. A conditional format expression can change the fill color of the fields like you show in your example.

                  2) Actually denying access to the field. This is done with the OnObjectEnter script trigger where you right click the field while in layout mode and select script triggers to set this trigger, then set it to run a script such as:

                  If [ YourTable::RadiobuttonField = "FS2" // FS1 field should be locked ]
                     Go to Next field
                  End If

                  Please note that if the fields were in related table, there are additional approaches that can used to control access to the field from the related table.

                  • 6. Re: enable disable fields
                    ClaudiuNemes

                    Hi Phil,

                    All done (conditional formatting and if script trigger) except "FS1 field should be locked".

                    If[rb_test::Financing Source = "FS1"]

                    Go to Field[rb_test::Disbursement Source 1]

                    Else If[rb_test::Financing Source = "FS2"]

                    Go to Field[rb_test::Disbursement Source 2]

                    If[rb_test::Financing Source = "FS1+FS2"]

                    Go to Field[rb_test::Disbursement Source 1]

                    End If

                     

                    Unfortunatelly I could not find a function/command in order to disable/hide the unwanted field according to the selection.

                    Yours,

                    Claudiu

                    • 7. Re: enable disable fields
                      ClaudiuNemes

                      Hi Phil,

                       

                      All done (conditional formatting and if script trigger) except "FS1 field should be locked".

                      If[rb_test::Financing Source = "FS1"]

                      Go to Field[rb_test::Disbursement Source 1]

                      Else If[rb_test::Financing Source = "FS2"]

                      Go to Field[rb_test::Disbursement Source 2]

                      If[rb_test::Financing Source = "FS1+FS2"]

                      Go to Field[rb_test::Disbursement Source 1]

                      End If

                       

                      Unfortunatelly I could not find a function/command in order to disable/hide the unwanted field according to the selection.

                      Yours,

                      Claudiu

                      • 8. Re: enable disable fields
                        philmodjunk

                        This is not the script that I suggested.

                        The script example I posted would be used with an OnObjectEnter trigger selected for the FS1 field. Go to Field or go to object may be a better option than go to next field for repeating fields, you'll need to test and see.

                        You'd use a different script with similar steps but a different expression in the if step with the onObjectEnter trigger set on the FS2 field.

                        I could not find a function/command in order to disable/hide the unwanted field according to the selection.

                        The above script does the disabling. A conditional format on the fields can be used to provide the visual cue that the field is not enabled:

                        rb_test::Financing Source  = "FS2"

                        Could be the conditional format expression for the FS1 field and it could specify a grey fill color to achieve the change in appearance.

                        It is also possible to make the field disappear entirely. See this demo file for several different approaches to making layout objects appear and disappear from a layout: http://www.4shared.com/file/XGrhkmVV/LayoutObjectVisibilityControlD.html

                        • 9. Re: enable disable fields
                          ClaudiuNemes

                          Hi Phil,

                          Yes, I already done that, but operator still could fill in data in the "disabled" field. The ideea was as in the flash sample, that if a field is disabled operator could not fill in data.

                          Yours,

                          Claudiu

                          • 10. Re: enable disable fields
                            philmodjunk

                            Had "already done" what? The conditional format does not prevent access to the field. The script trigger set on the field is intended to prevent that.

                            The key here is that you need script triggers on both FS1 and FS2 PLUS a conditional format to achieve the results that you want.

                            See this demo file: http://www.4shared.com/file/i2DtcKjT/FieldAccessControlRepeatingFie.html


                            • 11. Re: enable disable fields
                              ClaudiuNemes

                              Hi Phil,

                              The only solution I see is to create 3 layout's, one for each case FS1, FS2 and FS1+FS2 and the IF script trigger pointed to the related layout (Go To Layout). This solution looks for me a little bit "rough". I was looking for a smarter solution but from I saw in the FM function that doesn't exist.

                              If you have another ideea...

                              Many thanks for you time,

                              Have a nice weekend,

                              Yours,

                              Claudiu

                              • 12. Re: enable disable fields
                                philmodjunk

                                Did you download my last demo file? It does exactly what you specified as far as I can tell.

                                If you want to take this up a notch, you can use the invisible tab control as demonstrated in http://www.4shared.com/file/XGrhkmVV/LayoutObjectVisibilityControlD.html. Instead of making the fields disappear like in the demo, you put a copy of the field with access denied through field behavior settings in the inspector on one tab panel and one copy with access when in browse mode permitted on the other panel. This may be less design work in the long run than maintaining two duplicate layouts. An OnObjectModify trigger on the radio button field would use go to object to select the correct tab panel to either "lock" or "unlock" the field.

                                • 13. Re: enable disable fields
                                  ClaudiuNemes

                                  Hi Phil

                                  Your solution works as it is. I have already tested it. My main concern is that if "Go to Next Field" will work on a layout with many other fields. I already tested it by replacing "Go to Next Field" with "Go to Field..." and that don't work.

                                   

                                  Yours,

                                  Claudiu

                                  • 14. Re: enable disable fields
                                    ClaudiuNemes

                                    Hi Phil,

                                    Finally I got it work. I have tested it with more fields on the layout and with "Go to Field..." and it work just fine.

                                    Many thanks for the files you send me. Both are quite interesting and I'll try to study them this weekend.

                                    Many thanks also for you time,

                                    Please let me know if I could assist you somehow (flash etc.). Also please let know if you're interested about my colaboration proposal.

                                    Have a great weekend,

                                    Yours,

                                    Claudiu

                                    1 2 Previous Next