Show/Hide Toolbars

Managing an FVTerm Child iFrame in Javascript

Binding Events and Connection Error

 

An important function in the callback of the FVMsgApi.ConnectMsgFVTerm or ConnectFVTerm is binding to any events.  Events all exist in the initialized variable fvApi, passed in the completion function as the first parameter.  To activate and work events, you declare your events as described in each in the Events section.

 

Example - this excerpt from the Parent HTML sample shows a function initiating the FVTerm connection, setting a convenience variable and then setting an event handler for each new screen displayed in the FVTerm session.

 

 var fvApi = null;

 

 function StartFVTerm()

 {

         FVMsgApi.ConnectMsgFVTerm('FVTerm1','/FVTerm/SCTerm.html',

                         {"profile":"MedicareReg1"}, function (fvApiNew, sessionKey)

         {

                 // Convenient reference to FVApiSession (msgAPI mode) or FVTermSession (original FVTermParent mode)

                 if (fvApiNew)

                 {

                         fvApi = fvApiNew;

                         fvApi.onnewscreen = onNewScreen;        // Binding onNewScreen event handler

                         fvApi.onsend = onSend;                        // Binding onSend event handler

                         // Here is where you would bind any other events

                 }

                 else

                         alert('Connect Error! -- '+sessionKey);

         });

 }