Embedding Forms in another application

Parent Previous Next

Embedding Forms in another application


IYOPRO forms can be displayed embedded in other applications. When using this mode additional functions are available to

control the processing of the form by the hosting application.


The functions will only be invoked, if the form is displayed inside another application using the Internet Explorer control.


Controlling form submission

Prior to the submission of the form a "pre-submit handler" can be invoked in the hosting application. This handler can check,

amend or modify the form data. If an exception occurs during execution of the handler the form submission will be canceled.

As the name indicates the handler is invoked prior to any potentially defined form end action.


The pre-submit handler can be specified in the workflow properties of the form. It needs to enabled and allows to specify a text

string which is transferred to the hosting application. Which information is passed to the hosting application depends on the

implementation. Please note, that the information is always transferred as text.

Usually the data defined as "Host application parameter" will be a string representation of a data structure the application

understands. But simple text commands like e.g. "CHECKDATA" can be used as well.



When the user clicks "submit" on the form, it is checked, if the form is

a) embedded in another application

b) the hosting application provided an accessible function "OnFormPreSubmit"

If both conditions are met, the function is invoked in the hosting application and a representation of the form is passed.



Exchange information between the form and the hosting application


Information about specific form properties can be obtained by the hosting application by calling a function via the InvokeScript method of the browser control.

IYOPRO provides a set of functions allowing to obtain information about the pre-submit handler, the form variable values and to set the form variable values.


string WPFGetFormDataProperty(string name)

Get the value form property <name>.


Within the hosting application the pre-submit handler property values can be read by querying the properties PreSubmitExpression.IsEnabled and PreSubmitExpression.Info.

The first returns the value of the above checkbox, while the second returns the string provided as pre-submit handler parameter.



The values of individual form variable values can be read in a similar way, using the function:


string WPFGetFormObjectPropertyAsJson(string name)

Get the value form form variable <name> as JSON.


Please note: that all form variable names provided need to prefixed with "FormValues."



To return data to IYOPRO another function is available.


void WPFSetFormDataProperty(string name, string value)

Set form variable <name> to the value <value>. Value has to be a JSON representation of the desired value.




Controlling action button processing

A form with a button of the type "action" has an identical feature as the pre-submit handler. The button pre-click handler

allows to specify an information which is transferred to the hosting application prior to executing the action script of the

button.



Similar to the processing for the pre-submit handler, if the action button is clicked, IYOPRO checks that the form is:

a) embedded in another application

b) the hosting application provided an accessible function "OnActionButtonClicked"

If both conditions are met, the function is invoked in the hosting application and the host application parameter is provided to it.


With the available functions described above form variable values can be read and also changed.




Please refer to the pre-submit sample for an example implementation.