6 Replies Latest reply on Mar 19, 2012 2:43 PM by fbook

    calculate events running on server

    fbook Level 1

      I have an large XDP tempate. All fields are set to RunAt Client. Two fields, a checkbox and date field, which aree bound to an XSD schema, have have commented out script (using /*...*/) in the calculate event. The fields retain their values after the form is Submitted as a PDF (I have verified this using Stefan Cameron's "echo" url). However, the Forms Server seems to attemt to run the calculate event and blows the values of the fields away.

       

      Although I can fix the problem by removing the commented script, I have 2 questions:

       

      1)     I dont really understand why the Server is running the calculate event when I have "RunAt" client. However, The manual does say, "Scripts in forms designed for printing run at the server even when you set the scripts to run at the client."

       

              What does it mean by, "a form designed for printing"? How is that set?

       

      2)     Why does commented out script have such an affect?

       

       

      thanks

        • 1. Re: calculate events running on server
          dohanlon Level 3

          Not sure, but I am assuming you have Form Requires Server-side Data Binding and/or Scripting option set in File->Form Properties. This will tell Form server to execute server-side code for objects which require binding updates and or scripting. When form server is looking for code to execute on the server side, it looks for any value in the scripting node of your object within the xdp. Even if it is only a comment. Although Im not sure why the values are not being preserved other than maybe the script engine is expecting you to set a value in the calculate event. There are other places to turn this on as well (for example through the API), but the form properties one is the default.

           

          I believe the designing for print thing refers to building forms for use with Output ES where, there is usually no client interaction and forms are rendered and printed without a client, so the server will act as the client and execute scripts set to client on the server.

          1 person found this helpful
          • 2. Re: calculate events running on server
            fbook Level 1

            thanks, that was helpful.

             

            With some forms, we prepopulate a few basic fields when the form is first rendered, e.g. name and address, so we have always checked, "Form Requires Server-side Data Binding". However, we don't really want it to do any calculate event script execution, only merge FormData with the XDP. I assume that unchecking the "Form Requires Server-side Data Binding" would prevent this process???

            • 3. Re: calculate events running on server
              dohanlon Level 3

              Yes it would be needed when you are binding and populating/scripting data population. What are you using to call Form server with? API?

              • 4. Re: calculate events running on server
                fbook Level 1

                To render the form, we send FormData and XDP TemplateName by http Post. This is unpacked by a Java function which calls Form Server APIs to render the form.

                • 5. Re: calculate events running on server
                  dohanlon Level 3

                  Not tried it, but you could set the FormModel in RenderOptionsSpec to "client" and see if it would work. I will see later if i can duplicate what youre getting. Only other way would be to remove comments or add a $.rawValue = $.rawValue to the end of the calcs

                  • 6. Re: calculate events running on server
                    fbook Level 1

                    thanks for that. I must admit, I dont really understand why the options, "Form Requires Server-side Data Binding and/or Scripting" results in server side scripting when all my Form objects are set to "RunAt" Client