5 Replies Latest reply on Aug 29, 2012 4:04 PM by mthomas1506

    FMP12/IWP Script stops working in browser, works in FMP

    mthomas1506

      Hi everyone- I hope someone might be able to give me a hand with this

       

      I have developed a solution for my school to record and manage incidents with students, which is almost ready for use, but I've hit an issue with a script not working when accessed through Instant Web Publishing.

       

      I've included the content of the script as a screenshot attachment, but in a nutshell, users enter data into fields using drop-down menus, and then this script runs when they hit the "OK" button on the layout. The script assigns the values they selected to variables, then goes off to a few tables, looks up the values entered, and then replaces the contents of the record's fields with the key record values. The script works perfectly in FMP 12 itself, but fails at the highlighted line- with no errors- when run through IWP.

       

      I'm sure there's several better ways to achieve this result, but this probably shows my beginner's-level knowledge of FileMaker programming.

       

      My questions are these:

       

      1. Can anybody theorise as to why this script doesn't work through IWP, when it does in the application itself?

       

      2. Is there a better way I should be scripting, to achieve the same result?

       

      Thanks in advance for any assistance!

       

      Mark

        • 1. Re: FMP12/IWP Script stops working in browser, works in FMP
          ariley

          Hi Mark,

           

          Not every script step is compatible with Web publishing. If you haven't done so, choose Web publishing on the bottom left corner of your script Window and see if there are any steps that are incompatible.

           

          Also, Web publishing is finicky.

          --

          Sent from my Android phone with K-9 Mail. Please excuse my brevity.

          • 2. Re: FMP12/IWP Script stops working in browser, works in FMP
            mthomas1506

            Hi Agnes,

             

            Thank you for the reminder- forgot to mention that. I did check this, and everything in my script is- according to FIleMaker- compatible with IWP.

            • 3. Re: FMP12/IWP Script stops working in browser, works in FMP
              steve_ssh

              Hello Mark,

               

              Not sure if this is the cause of your stated problem, but I wanted to mention that the first line shown of your script looks questionable.

               

              The IF clause is testing for a condition where:

               

                Get( ApplicationVersion ) ≠ "Web Publishing Engine"

               

              If I'm not mistaken:

               

                 Get( ApplicationVersion ) includes version info as part of the returned string, for example, it might return something like:

               

                    "Web Publishing Engine 12.0v1"

               

              As such, your test in the IF clause will always return True, and your script "Check For Empty Fields" will always be invoked.  Thus, it's probably worth checking "Check For Empty Fields" for web compatibility.

               

               

              Another item to check:

               

              Make sure that any layout that you navigate to within your script (e.g. "CCC_PC_Issues", or any layout to which "Check For Empty Fields" navigates) uses the "classic" theme.  Under IWP, if your script tries to navigate to a non-classic-themed layout, the result will be an error and your script will stop execution at that point.

               

               

              Sincerely HTH,

               

              -steve

              • 4. Re: FMP12/IWP Script stops working in browser, works in FMP
                beverly

                Ha ha! Differently-designed, Agi. It all works as intended, although maybe not as you want. ;D

                 

                -- sent from my iPhone4 --

                Beverly Voth

                --

                • 5. Re: FMP12/IWP Script stops working in browser, works in FMP
                  mthomas1506

                  Hi Steve,

                   

                  Writing this for the sake of completeness

                   

                  You were exactly right about why the script was stopping- one of the layouts it was jumping to had a non-classic theme applied. Those layouts aren't used by people- only the scripts- so it wasn't immediately apparent. I appleid the Classic theme, and it began working immediately.

                   

                  I did know about IWP and Themes not playing nicely, but I didn't think to check it, cos I assumed all the layouts were Classic.I should have, because the point at which the script appeared to stop (based on what I saw in the browser) was in the layout before it.

                   

                  Regarding the IF clause, I think you're correct there too. I was working under the assumption that it would be true if the returned version contained that text- although I see now that that isn't logical. Rather than "not equals", I need to find something like "does not contain". Anyway, the script works fine now, so maybe I don't even need to perform this check.

                   

                  Thanks for the help.

                   

                  Mark