7 Replies Latest reply on Jul 29, 2012 11:05 PM by philmodjunk

    FMP 11 - tab navigation based on field value

    TraceyLillis

      Title

      FMP 11 - tab navigation based on field value

      Post

      Hi everyone,

      I haven't been able to crack this particular problem. 

      I have a contact table with a postcode(zip).  Based on a postcode such as NSW, I want a particular tab selected on another tab (same layout) which is called "NSW" to be selected.

      Can anyone point me in the right direction script wise please?  I have my script as per the attached screenshot plus my tab layout.

      Thanks

      Tracey

      tab_screenshot.png

        • 2. Re: FMP 11 - tab navigation based on field value
          philmodjunk

          How is the script being performed? (Do you have this set up with a script trigger or something?)

          Did you use the Name box in the inspector's position tab to give each tab the object names used in your script?

          In layout set up for this layout, do you see T05_CONTACTS listed in "show records from"?

          The field you use says "city_state". Is the two or three letter abbreviation the only text in this field or does include additional data such as a city abbreviation and a state?

          And (assuming that your data is only the data shown), your script can be simplified to be:

          Go To Object [ Object Name: T05_CONTACTS::Primary_city_state & " health tab"]
          Exit Script [Result: False]

          • 3. Re: FMP 11 - tab navigation based on field value
            TraceyLillis

            Script being performed - well - I want it to activate when the user clicks on the Health, Security and Declarations tab. 

            Yes, each state tab has had the name entered in the name box in the inspector.  I copied the names accross to the script, so they should be exactly what is in the inspector

            T05_CONTACTS is the layout that has the contact details, HSD tabs and nested inside this tab is the state tabs.

            Then 'city_state' only has the 3 letter abbreviation and is the only text in this field - WAIT - I just realised that I had the wrong field chosen here...... OK, changed it to the correct field (blush).  Corrected the script but still no action.

            Which option do I select for a script trigger if I want it to fire when a mouse is clicked please.  I have tried all of the options under script trigger and it still doesn't work.

            Thanks

            Tracey

            PS I haven't taken out the If step as I want it to check the postcode field and based on the 3 letters, change to the appropriate postcode tab once the HSD tab is clicked on with the mouse. 

            • 4. Re: FMP 11 - tab navigation based on field value
              Sorbsbuster

              "I want it to activate when the user clicks on the Health, Security and Declarations tab" - click on that Tab (twice, actually, to highlight the name) and attach the script to it as a Button.

              • 5. Re: FMP 11 - tab navigation based on field value
                philmodjunk

                Or select the entire enclosing tab control and use the OnObjectModify Trigger.

                PS I haven't taken out the If step as I want it to check the postcode field and based on the 3 letters, change to the appropriate postcode tab once the HSD tab is clicked on with the mouse.

                Yeah, but that doesn't require the If step from what I see and understand here.

                • 6. Re: FMP 11 - tab navigation based on field value
                  TraceyLillis

                  Hi Phil,

                  Thanks for your help.  I thought it didn't work for a minute, but the user needs to click on the 2nd set of tabs for it to activate - I was hoping to get it to activate of the first tab - Health Security and Declaration. 

                  Regards

                  Tracey

                  • 7. Re: FMP 11 - tab navigation based on field value
                    philmodjunk

                    There should be no need to click on the second set of tabs. Clicking either of the two "outer" tabs: Contact Details or Health, Security Declarations should trip the ONObjectModify Script trigger if it is set on the outer tab control.

                    Your script does need an if Step, but it should be this step:

                    If [ GetLayoutObjectAttribute ["HealthSecurityTab" ; "IsFrontTabPanel" ]
                       Go To Object [ Object Name: T05_CONTACTS::Primary_city_state & " health tab"]
                    End If

                    The If Step makes it possible to click on the contact details tab and have it stay on that tab panel and not jump to one of the inner tab panels courtesy of this script.

                    "HealthSecurityTab" would be the object name set up for this tab and you'd need to enter that exact text into the object name box. There's no need for the triggering event to be canceled and it might interfere, so leave out the exit Script [false] step.