Article: AN0001869Updated: 27.01.2019
The script will create two groups and adds couple of controls to them.
Where to use the script: Webpart Script
function OnLoad()
{
/* creating text in the page*/
OGForm.AddControl( OGForm.CreateLiteralControl("Example of a free text."));
var gi = OGForm.CreateOGGroup( 'gi1', 'First group', true, false);
OGForm.AddControl( gi);
var ti1 = OGForm.CreateOGTitle('ti1', 'Code', true, 'Enter a voucher code.');
var t1 = OGForm.CreateOGText( 't1', true, 'enter your code');
var ti2 = OGForm.CreateOGTitle('ti2', 'Name', false, null);
var t2 = OGForm.CreateOGText( 't2', false, null);
var r = OGForm.CreateRow();
var c1 = OGForm.CreateCol(false); //two columns
var c2 = OGForm.CreateCol(false);
c1.Controls.Add( OGForm.CreateItem(ti1, t1));
c2.Controls.Add( OGForm.CreateItem(ti2, t2));
r.Controls.Add(c1);
r.Controls.Add(c2);
gi.Controls.Add(r);
var gi2 = OGForm.CreateOGGroup( 'gi2', 'Settings');
OGForm.AddControl( gi2);
var ti3 = OGForm.CreateOGTitle('ti3', 'Obtain', false, null);
var chb1 = OGForm.CreateOGCheckBox( 'chb1');
var ti4 = OGForm.CreateOGTitle('ti4', 'Provide', false, null);
var chb2 = OGForm.CreateOGCheckBox( 'chb2', true);
r = OGForm.CreateRow();
c1 = OGForm.CreateCol(true); //one column
c1.Controls.Add( OGForm.CreateItem(ti3, chb1));
c1.Controls.Add( OGForm.CreateItem(ti4, chb2));
r.Controls.Add(c1);
gi2.Controls.Add(r);
OGForm.SetLinkNavigation( 'Hi|First.aspx>Second|end.aspx');
}
The resulting form looks like this: