close_edit_form

close_edit_form()

domain: client

language: javascript

class Item class

Description

The close_edit_form method triggers the on_edit_form_close_query event handler of the item, if defined:

  • If the handler returns true, the form is destroyed, the item’s edit_form attribute is set to undefined, and the method exits.

  • If the handler returns false, the operation is aborted and the method exits.

If the handler returns undefined, the method triggers the on_edit_form_close_query of the item’s parent group, if defined:

  • If the handler returns true, the form is destroyed, the item’s edit_form attribute is set to undefined, and the method exits.

  • If the handler returns false, the operation is aborted and the method exits.

If the group handler returns undefined, the method triggers the on_edit_form_close_query of the task:

  • If the handler returns true, the form is destroyed, the item’s edit_form attribute is set to undefined, and the method exits.

  • If the handler returns false, the operation is aborted and the method exits.

If no event handler is defined, or none of the handlers return false, the form is destroyed and the item’s edit_form attribute is set to undefined.

close_edit_form is mostly used with Virtual table.

Example:

Form 2 has a button Next Form and after click, the form is destroyed and Form 1 displayed.

function on_edit_form_created(item) {
    item.edit_form.find('#ok-btn')
        .text('Next Form')
        .off('click.task')
        .on('click', function() {
            item.close_edit_form();
            setTimeout(function() {
                show_f1(item);
            }, 300);
        });
}
function on_edit_form_close_query(item) {
    return true;
}

See also

Virtual Table

Forms

create_edit_form

edit_form

on_edit_form_close_query