ObjectGears Help

Forum   ObjectGears (Version:


This webpart is used for two purposes that are met by means of scripting:

  • Create a form (that can be edited) without any underlying class. This can beused for entering values, based on which an action is performed. E.g. you create records in other classes, start a workflow etc.
  • Create html that is pasted into a page. It is a very simple way of creating a report - displaying data from other classes by html. You can read the data directly from database, module procedure or you create html by means means of scripts.

You have this objects for scripting:

Name Description
OG Basic object for work with scripts.
OGForm Object for work with page content.
OGContentPage Page object.
OGModel Model, to which the page belongs. If the page is not assigned to any model, this value is NULL.
OGWebPart Object of the webpart Script.

You can configure several properties in the webpart settings:

Setting Description
Script In this script you can create definition of own form or html. You can define function OnLoad and OnPreRender. Both correspond to events from ASP.NET.
Script events This script contains functions for events, e.g. click on a button on toolbar.

Here you can enter url link to a file with styles. You have to save this file on server.

You can use here you own styles that will be pasted into the page with webpart.


Here you can enter url link to the file with javascript. You have to save this file on server.

You can use here also your own javascript that will be pasted into the page with webpart.

Example of events OnLoad and OnPrerender

function OnLoad()

function OnPreRender()

Example of an event definition

The event can be defined only for clicking on a toolbar button. The name of the event consists of the button ID and text _Click.

function bSave_Click()
   /* displaying various informatory messages */
   OGForm.SetInfo( 'Something is happening.');
   OGForm.SetError( 'There is an error.');
   OGForm.SetSuccess( 'Data were saved.');
   OG.Log.Write('Button save.');

   /* reading data from a text field */
   var tb = OGForm.GetControl( 't1');
   OGForm.SetInfo( 'Code: ' + tb.Text);

Example of a style definition

   font-size: 10px;

Example of javascript

function MyFunction()

Takeover of values from URL

You can react on values provided in URL within a script. You can process the values and fill in controls with them.

The values shall be taken over only at the first display of the page (when there is no postback). Use function IsPostback to identify these situations. After that fill in the data into controls by the method SetData.

The following example takes over value from the variable data at the first page display from the URL and inserts the value into the control t2.

if ( !OGForm.Page.IsPostback)
   t2.SetData( OGForm.Page.Request.QueryString["data"]);

This website is using cookies files to provide services and analyse visits. You agree with that by using this website.     Further information