JavaScript CookBook/Modal Forms/Accessing items from the main form in the modal 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 items/values from the main form in the modal form

Problem: You want to access form items of the main form from a custom script embedded in your modal form.

Solution: Modal Forms are integrated via <IFRAME>s in the main form. Therefore you can use the property from within the modal form to access the parent form:

//customscript embedded in modalform via customscript attribute
//use the 'modalform:ready' event so the script gets only triggered if the form is used as a modal form
IG.vent.on('modalform:ready', function(form){
   if ( &&{ //test if an IG.form object is available in the parent window
       var mainForm =;
       var parentFormField = mainForm.getItemById('PARENT_FORM_FIELD'); //get 'PARENT_FORM_FIELD' from mainForm
       parentFormField.hide(); //hide the field of the parent form

Other Recipes in this category: