addItem

adds an item to the form

void addItem(string|number pId,object itemData,number pos,number insertAfter);

Parameters

pIdstring|numberthe parent item's id, i.e. the id of the existing item you want to nest a new item into
itemDataobjectthe object of a new item
posnumberthe position that the new item will be added to
insertAfternumberthe position of the item after which a new item will be inserted

Example

// to add as an individual item
myForm.addItem(null, itemData, pos, insertAfter);
 
// to nest into some existing item
myForm.addItem(pId, itemData, pos, insertAfter);

Details

if you don't want to specify the parent item, set the pId parameter to "null".

For radio buttons you must specify the pId parameter as an array with 2 elements:

  • id - the radio button's id
  • value - the radio button's value

If any columns are used, a new item will be inserted into the column where item[pos] positioned, before it. "insertAfter" specifies that a new item will be inserted after item[pos], to add the possibility to make a new item the last in the column. This param is ignored when inserting a new column.

Back to top