JavaScript CookBook/Modal Forms/Accessing the modal form from the main form

From GeoMedia Smart Client
Jump to: navigation, search
GMSC 2013/2014 Javascript API Overview Form Events Types Utility Functions client-side Validation Conditions Interaction with SmartClient Cookbook Cheatsheet


Accessing the modal form from the main form

Problem: You want to access the modal form from the main form in order to transfer entered values from there to the main form.

Solution: The IG.openSimpleModalForm() function supports closeAction parameters that can transfer values between the two forms or execute other actions when the modal form is closed.

Since GMSC 2014 you can also specify a custom responseHandling function that is executed before the modalForm is closed:

//customscript.js
 
//this function should reload MAINFORM_FIELD after the modal form has been closed:
function reloadField (response, modalForm, mainForm){
  mainForm.getItemById('MAINFORM_FIELD').reload();
}

the name of the specified function is then passed in as closeActionParam:

<!-- workflow.xml-->
  <FormAction name="EDITCS" label="Edit" action="SCRIPT[IG.openSimpleModalForm({controller: 'SampleController',form:'TEST_FORM', id: {FORM.COORDINATESYSTEM_ID}, closeAction: ['responseHandling']})]" 
                      help="Open Sample Modal Form" image="ig-icon-edit" />



Other Recipes in this category: