7 Replies Latest reply on May 6, 2009 9:15 AM by philmodjunk

    Scripts Question

    dinora

      Title

      Scripts Question

      Post

      I have a field where I ask

       

      Are you taking a cruise -  Answer is radio button Yes/No

       

      What I want to do is that if the answer is Yes

       

      Then the next two fields to display are

       

      CruiseLine (Drop down Value List)

      Ship (Drop down Value list showing values from cruiseline only)

       

      If the answer to taking a cruise is "NO" then the two above fields should not display as they are not applicable

       

      Can FM Pro 10 do this?

       

        • 1. Re: Scripts Question
          mrvodka
            

          If you create a tab control with two panels, you can use a script that has go to object []. So the default tab panel should probably be blank. The second can have those two fields. You can make the tab "invisible" by playing with the lines and colors, such as using 0 point line width, etc.

           

          Noe you can either put a button on the radio to call your script, or you can use the new script triggers to run the script when the value is changed.

          • 2. Re: Scripts Question
            mrvodka
              

            BTW, another option is an older technique but still great.

             

             Visibility Trick

            • 3. Re: Scripts Question
              dinora
                

              Thank you

               

              Both of your solutions seems to work, however I am still puzzled by the Visibility database - It works but I cannot figure out how to do it

              • 4. Re: Scripts Question
                mrvodka
                   The key is the 1 row portal. The fields that are contained within that portal disappear when the relationship is invalid, IOW when there are no matching child records.
                • 5. Re: Scripts Question
                  KIDO
                     <!-- [if gte mso 9]><xml> <w:WordDocument>   <w:View>Normal</w:View>   <w:Zoom>0</w:Zoom>   <w:PunctuationKerning/>   <w:ValidateAgainstSchemas/>   <w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid>   <w:IgnoreMixedContent>false</w:IgnoreMixedContent>   <w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText>   <w:Compatibility>    <w:BreakWrappedTables/>    <w:SnapToGridInCell/>    <w:WrapTextWithPunct/>    <w:UseAsianBreakRules/>    <w:DontGrowAutofit/>   </w:Compatibility>   <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel> </w:WordDocument> </xml><![endif] --><!-- [if gte mso 9]><xml> <w:LatentStyles DefLockedState="false" LatentStyleCount="156"> </w:LatentStyles> </xml><![endif] --><!-- /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal      {mso-style-parent:"";      margin:0cm;      margin-bottom:.0001pt;      mso-pagination:widow-orphan;      font-size:12.0pt;      font-family:"Times New Roman";      mso-fareast-font-family:"Times New Roman";      mso-ansi-language:EN-GB;} @page Section1      {size:595.3pt 841.9pt;      margin:72.0pt 90.0pt 72.0pt 90.0pt;      mso-header-margin:35.4pt;      mso-footer-margin:35.4pt;      mso-paper-source:0;} div.Section1      {page:Section1;} --><!-- [if gte mso 10]> <style> /* Style Definitions */ table.MsoNormalTable      {mso-style-name:"Table Normal";      mso-tstyle-rowband-size:0;      mso-tstyle-colband-size:0;      mso-style-noshow:yes;      mso-style-parent:"";      mso-padding-alt:0cm 5.4pt 0cm 5.4pt;      mso-para-margin:0cm;      mso-para-margin-bottom:.0001pt;      mso-pagination:widow-orphan;      font-size:10.0pt;      font-family:"Times New Roman";      mso-ansi-language:#0400;      mso-fareast-language:#0400;      mso-bidi-language:#0400;} </style> <![endif] -->

                  Hi Dinora

                   

                  Try the following approach:

                   

                  In layout mode go to Menu – Layouts – Duplicate Layout

                  In Layout Setup rename your copy of the layout to, let’s say, NoCruise

                  Remove the 2 referred fields and names from NoCruise Layout

                   

                  Now create a script “Choose Cruise Layout” similar to next one:

                   

                                                 If [ Your_question_field = “No”]

                                                    Go to Layout [NoCruise]

                                                    Go to field [ Your_NextField]

                                                Else

                                                    Go to Layout [ Your_Other_Layout]

                                                    Go to Field [Your_Other_NextField]

                                               Endif

                   

                  In both layouts, one at a time, select your question field, then MENU – FORMAT – SCRIPT TRIGERS and in the dialog box select OnObjectExit and assign your NoCruise script.

                   

                  This may solve your visibility issue.

                   

                  Best regards

                   

                  KIDO

                  • 6. Re: Scripts Question
                    mrvodka
                       Why duplicate the entire layout for two fields? Its horrible from a maintenence perspective....
                    • 7. Re: Scripts Question
                      philmodjunk
                        

                      Don't forget that you can use conditional formatting to hide objects on FMP 10. Just set background fill and text colors to match the background of your layout.

                       

                      You can also assign script triggers that use "on Object enter" to move the cursor to a different field in the tab order.

                       

                      Thus, you can hide the objects from view and keep them from entering the field with a script trigger by moving them to the next field in the tab order.