10 Replies Latest reply on Jun 3, 2014 12:08 PM by gregdc

    Lost in the land of POPOVER

    gregdc

      Title

      Lost in the land of POPOVER

      Post

           Where do I go for instructions on how to put together a Popover to enter new information?   I created the popover button, and get the popover setup, but how do I put the layout in the Popover and the script that stands behind it to do the validation?   

           Also, do Popovers work in WebDirect?

            

           GregDC

        • 1. Re: Lost in the land of POPOVER
          philmodjunk

               Feel free to post follow up questions in the misnamed "Post a new Answer" box if this info is not enough to enable you to work with popovers.

               You can think of Popovers as special format tab controls with a single panel instead of multiple panels.

               When you add a popover button to your layout, the popover frame automatically appears and you can then format and size the frame to be what you need and, just like a tab control panel, you can then drag and drop or copy and paste layout objects into the popover panel just like you would a tab control.

               Popovers do work in WebDirect, but you will encounter issues with them in WebDirect that do not occur when the database is accessed by FileMaker Pro instead of a web browser.

               You can download the Known Bugs List database and use Popover as a keyword to find the bug reports linked to Popovers. 2 are specific to using popovers with WebDirect.

                

          • 2. Re: Lost in the land of POPOVER
            gregdc

                 Thanks for the point in the right direction!!

                 Now my question is how to turn this into a place to add new records to the related table.

                 More fun ahead!

            • 3. Re: Lost in the land of POPOVER
              philmodjunk

                   And what related table is that? What are the tables and relationships involved?

              • 4. Re: Lost in the land of POPOVER
                gregdc

                     I have a Person table PK Person_Pk,  Sponsor_FK.....  >----|- Sponsor Table PK Sponsor_PK  

                     Button on Sponsor allows the addition of a new Sponsor record.  Popover is the "short form" (aka minimum info) on the new sponsor.   The fields are brought over via pick list to the Popover.  I enter a new sponsor but that record is never added to the Sponsor table.   Picking a sponsor is normally done through a drop down list.

                • 5. Re: Lost in the land of POPOVER
                  philmodjunk

                       Do you mean that you have a one sponsor to many persons relationship?

                       That would be this relationship:

                       Sponsors----<People

                       Sponsors::Sponsor_PK = People::Sponsor_FK

                       and are you on a layout for People when you want to create a new Sponsor record?

                       And should that new sponsor record need to be linked to the current People Record?

                       If that is what you are trying to set up, enable "allow creation of records via this relationship" for Sponsors, in the sponsors to people relationship.

                       On your people layout, add your popover and put fields from Sponsors inside the popover frame. If the current people record is linked to a sponsor record, the fields in the popover will display data from that sponsor record, but if the current people record is not linked to a sponsor record, the fields will be empty. If you then enter data--such as the new sponsor's name into the field, this will cause FileMaker to create a new Sponsor record and automatically link it to the current people record.

                       Note 1: to "disconnect" a people record from their sponsor record, clear the Sponsor_FK field.

                       Note 2: From the names used here, they suggest the possibility that you could use a single data source table for both People and Sponsors and then you'd use a second Tutorial: What are Table Occurrences? of People as the table of Sponsors in this relationship.

                       For an explanation of the notation that I am using, see the first post of: Common Forum Relationship and Field Notations Explained

                  • 6. Re: Lost in the land of POPOVER
                    gregdc

                         You have the relationships correct.    A sponsor can have zero to many people.  

                         I am on the Person record, adding or changing the Person record.   People can change sponsors, sometime those sponsors are new sponsors.  This is where the Popover key is supposed to come in.   I should allow the operator to add a new sponsor, using the short form in the Popover. 

                         When I use the Popover now,and there is already a value in the sponsor field it changes the Sponsor record instead of adding a new one.   Not what the client wants. <grin> .   If there is no sponsor in the the person record the button will add a new record to the sponsor table.   So the trick is how do I tell the button that I want to create a new Sponsor every time it is used?   Do I trigger a script on OnObjectEnter?  What would I put in the script?   Does the Popover have a layout name? 

                           

                    • 7. Re: Lost in the land of POPOVER
                      philmodjunk

                           Perhaps you missed this from my last post: wink

                           

                                Note 1: to "disconnect" a people record from their sponsor record, clear the Sponsor_FK field.

                           Here's how you could automate that:

                           In layout mode, open the popover. Select the Frame by clicking it (You need to see selection "handles" to show that it's selected.)

                           Right click the frame and select "script triggers"

                           Select the "onObjectEnter" trigger--which will be tripped each time that you click the popover button, select specify, click the Plus sign control to create a new script performed by this trigger and then create a script like this:

                           If [ Not Isempty (People::Sponsor_FK) // person is already linked to a sponsor]
                              Show Custom Dialog ["This person already has a sponsor. Create a new sponsor record?"]
                              If [ Get ( LastMessageChoice ) = 1 // OK was clicked ]
                                 Exit Script []
                              End IF
                           End If
                           Set Field [ People::Sponsor_FK ; "" ]

                           PS: I deliberately did not specify this detail in my last post as I wanted confirmation that the basic suggestion would work for you before proceeding.

                           Note that your popover cannot, as designed, be used to select an existing sponsor. So you could not use it to change a person's sponsor from Sponsor A to Sponsor B if both already have records in the Sponsors table. There are ways, however, to add that option.

                      • 8. Re: Lost in the land of POPOVER
                        gregdc

                             This process works great!  Thanks Phil.    One small hassle, when I close the Popover the People record displays the ID number of the Sponsor instead of their name.   If I go away from the record and come back the Sponsor name is there.   The Person table stores the Sponsor PK.  The Sponsor name shows in the drop down box and when I choose from there I see the Sponsor name.    

                             I know that this must be something "simple" that I am missing,  Care to point me in a right direction yet again, please?

                        • 9. Re: Lost in the land of POPOVER
                          philmodjunk

                               I'm not sure exactly how you've designed your layout. Did you place the Sponsor name field from Sponsors on your layout to show the sponsor name? Or have you formatted the Sponsor_FK field as a pop up menu?

                               Try this test: After making this change, just click a blank area of the layout for the same record to commit the record. Does that cause an update and the sponsor name then appears?

                               If so, you may want to set the OnObjectExit trigger on the Popover frame to do a one line script: Commit Records.

                          • 10. Re: Lost in the land of POPOVER
                            gregdc

                                 That did it!   The commit on exit worked great.   Again many thanks