close_edit_form
- Item.close_edit_form()
- domain:
client
- language:
javascript
- class:
Description
The close_edit_form method closes the item’s edit form. Before
destroying it, it queries up to three handlers in cascade, all sharing
the same name (on_edit_form_close_query) but defined on different
classes:
Class
Item()on_edit_form_close_queryClass
Group()on_edit_form_close_query (the item’s parent group)Class
Task()on_edit_form_close_query (the task)
The table below summarizes how close_edit_form behaves depending on
which handler is queried and what it returns:
Step |
Handler called |
Behavior |
|---|---|---|
1 |
If defined and it returns If defined and it returns If undefined, or it returns |
|
2 |
|
Same logic as step 1: |
3 |
Same logic: If this handler is also undefined (or returns |
Summary: close_edit_form walks through the three levels (item →
group → task) until it gets a definitive answer (true or false).
If none of the levels decides, the form is closed by default.
Typical use case
close_edit_form is mostly used with
Virtual tables.
Example
In this example, form 2 has a Next Form button. On click, the form is
closed and form 1 is displayed after a short delay.
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
Related attributes
Related functions
Related concepts