6 Replies Latest reply on Sep 30, 2014 4:20 PM by keywords

    Prohibit Field Entry in Browse Mode based on Another Field

    joey_legos

      I'd like to prohibit data entry in browse mode only when a different "Yes/No" field is set to "No". I have applied conditional formatting to grey out the field when the "Yes/No" field is set to "No", however I have not been able to successfully disable field entry. Any suggestions? Thanks.

        • 1. Re: Prohibit Field Entry in Browse Mode based on Another Field
          erolst

          joey_legos wrote:

          however I have not been able to successfully disable field entry

           

          Use an OnObjectEnter trigger

           

          If [ not Table::entryAllowed? ]

            Commit Record

          End If

           

          where I suggest that instead of a text field with “Yes” and “No”, you use a number field (called entryAllowed? in the script snippet) with a Boolean value list (just a 1), and formatted as a checkbox.

           

          Much more versatile, easier to query in scripts and calcs, and if you like, you can use the Boolean section in the Data Formatting area of the Inspector to display the field as “Yes” or “No”.

           

          If you want to continue using Yes/No, the the first script step needs to read

           

          If [ Table::field = "No" ]

          1 of 1 people found this helpful
          • 2. Re: Prohibit Field Entry in Browse Mode based on Another Field
            planteg

            erolst,

             

            isn't your method of committing the record brutal ? How about bringing the focus on the next field if the OnObjectEnter trigger calculation determines that data entry is not allowed ?

             

            Joey, if you use FileMaker 13, you could use another trick: have two fields at the same position. If editing is allowed, hide the field for which Field Entry is not allowed for browse mode. If editing not allowed, then hide the field for which Field Entry is allowed for Browse mode.

            • 3. Re: Prohibit Field Entry in Browse Mode based on Another Field
              erolst

              planteg wrote:

              erolst,

              isn't your method of committing the record brutal ? How about bringing the focus on the next field if the OnObjectEnter trigger calculation determines that data entry is not allowed

               

              I don't see what is brutal about committing a record. Neither you nor I know what the OP wants to achieve exactly, or what their workflow looks like. Maybe there is no next field.

              • 4. Re: Prohibit Field Entry in Browse Mode based on Another Field
                planteg

                erolst,

                 

                looks like the term brutal was not appropriate. I worked a lot with Access, which behave in the same way as FM, that it, by default, record is committed automatically when you move to another record. personally, most of the time I disabled that and had Save or Cancel buttons.

                 

                So back to the question, I wonder if it's appropriate to commit the record in that instance ? And I agree that there could be no next field.

                 

                This is where I find it difficult to go from Access to FileMaker: in Access I would disable or enable the other field depending on the Yes/No value. The same could be done if one would code in X Code. But that's not FileMaker philosophy, so you need to make some work around since you can't edit field's options from within a script. Maybe some day that will be possible.

                • 5. Re: Prohibit Field Entry in Browse Mode based on Another Field
                  erolst

                  planteg wrote:

                  Maybe some day that will be possible.

                   

                  FMI gave us “Format if”, then “Hide if” – maybe “Edit if” is next on the list?

                  • 6. Re: Prohibit Field Entry in Browse Mode based on Another Field
                    keywords

                    planteg is on the right track. The problem with conditional formatting is that even though you might make the field invisible by making it the same colour as the background it is till there, and if a user hppens to click in the right spot they can enter it. On the other hand if you set the field to Hide it completely disappears—although it is still on the layout it is totally inaccesible to the user.