I have a fragment that contains a script object and a text field. The text field's initialize event handler calls a method in my fragment's script object. Everything works fine in preview mode of the fragment.
When I create a new file and use the fragment in that file, the initialize event handler in my fragment is invoked just fine, but the method I'm trying to call in the script object in the fragment never fires. What I have looks like this:
- script object "Foo"
- text field::initialize
When I preview the fragment, I get "hello" and "Foo" message boxes.
When I preview the file, I only get the "hello" message box.
When calling the script object that is embedded in the fragment you have to path specifically to that object. The scriptobjectName.method is not enough to find what you want. You would need FragmentName.ScriptObjectName.Method()
I tried it here and it worked.
You may want to use a script Fragment instead of using an embedded script object on a fragment. The script fragment would run in the form root context and would behave like you are expecting.
Put it in the file so that it is at the root of the file. It will act like any other fragment (the designer cannot edit it unless they have access to the fragment source) and it will be resolved when the form is rendered, so any updates are picked up right away.