Jam.py documentation

create_inputs

create_inputs(container, options)

domain: client

language: javascript

Description

Use create_inputs to create data-aware visual controls (inputs, checkboxes) for editing fields of the item.

This method is usually used in the on_edit_form_created events.

The following parameters are passed to the method:

  • container - a JQuery object that will contain visual controls, if container length is 0 (no container), the method returns.

  • options - options that specify how controls are displayed

The options parameter is an object that may have following attributes:

  • fields - a list of field names. If specified, a visual control will be create for each field whose name is in this list, if not specified then the fields attribute of edit_options will be used (if defined), otherwise the layout, created in the Edit Form Dialog of Application builder, will be created

  • col_count - the number of columns that will be created for visual controls, the default value is 1,

Before creating controls the application empties the container.

Example

function on_edit_form_created(item) {
    item.create_inputs(item.edit_form.find(".left-div"),
        {fields: ['firstname', 'lastname', 'company', 'support_rep_id']}
    );
}