8 Replies Latest reply on Feb 23, 2009 12:55 AM by davidthorp_1

    Field "enabled" / "visible" ???

    synergy46

      Title

      Field "enabled" / "visible" ???

      Post

      OK, here is a tough one for all the 'experts'... :smileyhappy:

       

      I have a single table:  Members.

       

      There is a MemberName Field

      There is a Status field

      There is a VouchedFor field

       

      The Status field is a 'drop down' text box.

      The Status field is next to the VouchedFor field

       

      Question: 

      "When the user selects "Visitor" in Status, I want the VouchedFor field to become visibible/enabled/useable.  Otherwise it is not.

       

      I thought about changing the color for VouchedFor to be the same as the background when .not. "Visitor" but that does NOT solve the user who tabs into it anyway....

       

      Anyone got any ideas?

       

      Thanks

       

      Ron

       

        • 1. Re: Field "enabled" / "visible" ???
          vcirilli
            

          One option if your in FM v10

           

          Duplicate your layout and add the VouchedFor field to it

          remove VouchedFor field  from  from the original layout

           

          create a script

          if  Status field = "Visitor"

           goto  VouchedFor Layout.

          end if

           

          Set status fields onObjectModify script trigger to the script above.

           

          when the user sets status to visitor the layout will change and the field will appear.

           

           

           

           


           

          • 2. Re: Field "enabled" / "visible" ???
            synergy46
              

            Thanks for the idea.  I hadn't thought of that.  But, it seems kind of problematic in that when the user switches to the 2nd layout and enters the VouchedFor name then the next entry in Status (Regular, Lifetime, 50 year,... Vistor) if .not. Visitor would have to be switched back... 

             

            Is this what FM had in mind?  Hard to believe they don't have an 'enabled' or 'visible' characteristic.  

             

            Yes, I am using FM 10 Advanced....

             

            Ron

            • 3. Re: Field "enabled" / "visible" ???
              vcirilli
                

              >> then the next entry in Status (Regular, Lifetime, 50 year,... Vistor)

              I'm losing you, are you dealing with a one record at a time FORM layout or multi record LIST layout?

               

              • 4. Re: Field "enabled" / "visible" ???
                synergy46
                  

                I am in Form view dealing with one record at a time. 

                 

                 

                • 5. Re: Field "enabled" / "visible" ???
                  vcirilli
                    

                  >>>  seems kind of problematic in that when the user switches to the 2nd layout and enters the VouchedFor name then the next entry in Status (Regular, Lifetime, 50 year,... Vistor) if .not. Visitor would have to be switched back... 

                   

                   

                  You could add an onRecordLoad script trigger to the layout. When the user moves to a different record the trigger script sets what layout to they would see.

                   

                  Trigger a script something like

                   

                  If   status = Visitor goto yourVisitorLayout

                  else

                  yourNotVisitorLayout

                  end

                   

                  >> Is this what FM had in mind?  Hard to believe they don't have an 'enabled' or 'visible' characteristic. 

                  I've only see this functionality  added via scripting and triggers.

                   

                   
                  • 6. Re: Field "enabled" / "visible" ???
                    davidthorp_1
                      

                    Hi, 

                     

                    I appreciate this problem is 'solved', however, I can offer two alternatives here, that you may like better.  If nothing else then it's food for thought.

                     

                    Particularly I don't like the multiple layouts option because maintaining layouts that are identical except for one or two small things, can sometimes be tiresome, at best.

                     

                    Also if you ever need multiple fields to be hidden or visible in different combinations then you're building a layout for every possible combination. 

                     

                    That said, it's a good solution in small situations but here's a couple of other options if you like...

                     

                    1. Create a relationship to a dummy table, or even back to the same table, where the left side of the relationship is an unstored calculation field that evaluates to 0 or 1 depending on  whether or not you want the Visitor field visible. Then the right side of the relationship is simply a calculation field =1.

                     

                    Then create a one row portal on your layout that has dimensions only one pixel in each direction larger than your Visitor field and put it behind the visitor field.  The visitor field will then appear or disappear according to  your requirements.

                     

                    This method needs no script triggers either, so it works in versions prior to 10. 

                     

                     

                    2. This is one i only figured out a few days ago, and I like it a whole lot better because it doesn't require any extra layouts, relationships or anything.  It does however require a script trigger similar to vcirlli's solution, so this option therefore requires FM10.

                     

                    Create a tab panel with two tabs.  In the object info, give the first tab an object name of "visitor visible" and the second tab "visitor NOT visible".  

                     

                    Remove all formatting from the tab panel so that it is completely transparent (no embossing/engraving either).  Change the font size of the labels to 1 point to make them as small as possible and then go into the tab panel options, set the tab width to a fixed width of 0 pixels, and the tab justification to right.  This effectively hides the tabs and makes them impossible to select manually.

                     

                    Now put your Visitor field in the middle of the "visitor visible" tab, and make the tab panel only one pixel in each direction larger than the field (like the portal solution above), and leave the "visitor INvisible" tab empty.

                     

                    Then have a script like vcirlli's but instead of go to layout, make it go to object instead.

                     

                    Kudo's to vcirlli for a solution that works well.  If the above alternatives are any use instead or as well, then hopefully sharing them is helpful.

                     

                    Cheers!

                    David. 

                    • 7. Re: Field "enabled" / "visible" ???
                      vcirilli
                        

                      Hey David,

                       

                      Those are much better ways to handle the invisible field situation.

                       

                      Thanks for adding to the post I'll definitely make use of your techniques.

                       

                      Vincent

                       

                      • 8. Re: Field "enabled" / "visible" ???
                        davidthorp_1
                          

                        Hi Vincent,

                        No worries.  Thanks for the reply.

                        Cheers...

                        David.