5 Replies Latest reply on Mar 4, 2009 2:39 AM by Orlando

    Value List Selection Prompts New Field

    SideKick315

      Title

      Value List Selection Prompts New Field

      Post

      I have just started using Filemaker for more in-depth purposes and have hit a wall.

       

      Is it possible that choosing a selection from a drop-down list will prompt a field to be displayed that normally isn't?

       

      For instance I would like to have a drop down list of different sports, and when I select 'soccer' a new field appears that I can type "shirt size" into.

       

      I know how to set up value lists and drop downs, but have spent hours trying to find how to do this.

        • 1. Re: Value List Selection Prompts New Field
          Orlando
            

          Hi SideKick315, and welcome to the forum

           

          There are a few ways you can go about this, and will depend on the version of FileMaker you are using.

           

          The simplest and best way for any version is to use relationships and portals to show and hide the field, based on the input in a field. And example can be found on the Database Pros website:

           

          http://www.databasepros.com/FMPro?-DB=resources.fp5&-lay=cgi&-format=list.html&-FIND=+&resource_id=DBPros000743

           

          But this is for displaying a field when a value, any value, has been entered, but it can give you an idea of hoe this works.

           

          Another approach would require FileMaker 10 and you would setup Script Triggers to either show and hide tab panels, or change the layout the user is on depending on how much extra info you want to capture.

           

          If you are on FileMaker 10 and want to explore the Tab option more then let me know and I can go into more detail for you.

          • 2. Re: Value List Selection Prompts New Field
            SideKick315
              

            Thank you for your reply.  I took a look at that sample database, which seemed to do what I need to, however when I open the file in Filemaker it says it cannot be modified.  Also I need the fields to be triggered by the selection of an item from a drop-down, not typable text (we can't trust our employees spelling unfortunately). 

             

            Currently our database only has one table and has a single tab.

             

            I am using FileMaker 10.  I would be very grateful if you could walk me through the necessary scripts.  Thanks!

             

            • 3. Re: Value List Selection Prompts New Field
              Orlando
                

              No worries SideKick315, I can walk you through waht you need to do.

               

              But first since you are using FileMaker 10 you have the option of going with the pop-up style fields in the demo, or have script triggers take the user to a new layout, or different panel of a hidden Tab setup, would probably be better is you have various different options.

               

              Let me know which you would prefer, and if you want to see it in action I can put together a demo for you if you want.

              • 4. Re: Value List Selection Prompts New Field
                SideKick315
                  

                I apologize in the delay, I've been out of town for a few days.  I would like the record to stay in one place throughout the script triggers if possible.  That is, as of now all the fields are contained in one tab and that would be preferable.  I would do whatever is necessary behind the scenes to make it all appear to be one cohesive record, without the user having to change tabs--or as close to this as possible.

                 

                As far as what that entails, I will trust you.  I plan on having quite a few variables and fields appear (probably at least one 'exposed' field for each sport on the list, about ten sports).  

                 

                I would greatly appreciate a working demo. Once I can get the process down, I can implement it with all the other instances.  Thanks!

                • 5. Re: Value List Selection Prompts New Field
                  Orlando
                    

                  My turn to apologize for the delay, busy week at work.

                   

                  OK I have written out a fairly long description of what you need to do, plus put a demo online for you to download, I hope this does the trick for you.

                   

                  How this is going to work is to have a separate Tab for each sport, with the appropriate field under each tab, when your user changes the value in the Sport Type field a script triggers and changes the tab to the appropriate sport with the additional field.

                   

                  What you need to do is first setup your Tab Panel on your layout, using the Tab Control tool draw an are for the tab panel and then when the Tab Control Setup dialog appears create a tab for each sport naming it the sport to help keep track, however the first one needs to be titled 'BLANK'.

                   

                  Once you have all the tabs created click OK in the Tab Control Setup dialog, no need to worry about any of the other settings yet as we will be coming back to tis at the end. 

                   

                  On your layout with the new tab panel each tab you will need to do two things

                  1. is give the tab an object name, after the sport. You do this by clicking on a tab when it is the front tab and a highlight will show around the tab, and then using the Object Info Palette, View > Object Info, give it an object name to match the Sport as it is in your selection field, this is important because our script will take the value of that field and go to the object with the same name.

                  And the first tab needs to be named 'BLANK' to match the name.

                  Also name your object in upper case.

                  2. Place the appropriate fields under its tab.

                   

                  Now we need to write a script that will change the tab based on the value of the Sport selection field. You can add more but it is basically a one line script

                   

                  TabSelect --

                  Go to Object [ If ( IsEmpty ( TABLE::SportSelect ) ; "BLANK" ; Upper ( TABLE::SportSelect ) ) ]

                   

                  Now we have all the components setup we need to setup the script triggers, we will be using two different triggers to run the same script, OnRecordLoad and OnObjectModify

                   

                  OnRecordLoad:

                  Back on your layout, in Layout Mode, go 'Layout > Layout Setup...' and then select the Script Triggers tab.

                  Now select OnRecordLoad and when the Specify Script dialog appears select you new script 'TabSelect' and then click OK and OK again.

                   

                  OnObjectModify:

                  Still in Layout Mode, click on your field and go 'Format > Set Script Triggers...' and from the Set Script Triggers dialog select OnObjectModify and when the Specify Script dialog appears select 'TabSelect' again and then click OK and OK again.

                   

                  Now everything should be working, go into Browse Mode and test to make sure it does, select a sport and see if the tab goes to the appropriate tab.

                   

                  Now if it all works well we just have one more thing to do and that is hide the tab from the user.

                   

                  Back in Layout Mode double click on the tab panel and from the Tab Control Setup dialog change the following settings

                   

                  Default Front Tab: 'BLANK'
                  Tab Justification: 'Left'
                  Appearance: 'Square'
                  Tab Width: 'Fixed Width of:' & 0 Pixels

                   

                  Now click OK and the Tabs will be bunched up on the left, the last bit to do is change the line thickness to 'None' and your tab has now disappeared.

                   

                  Now go back to Browse Mode and see how it all works.

                   

                  I have put together a very simple demo file for you to look at

                   

                  http://dl.getdropbox.com/u/552420/FileMakerForumDemos/TabHideAndDisplay.fp7

                   

                  If you have any questions then please do ask.