2 forms in one editor


General question and feasibility question.

I’m basically on a CRM-ish tool building and testing the framework. I got a case where i basically need to be able to capture feedback from a customer but also set a todo item in other entity/ table. This preferably from the same editor window, using only one save action.

Thanks for all/any feedback



Hi @tim

Let’s say we have a Person entity and a ToDoEntity entity and we want to be able to add a new ToDoEntity instance when creating or editing a Person instance. Here is an example how it implemented:

  1. Open you PersonEdit descriptor and add new instance component for ToDoEntity entity:
        <instance id="personDc"
            <fetchPlan extends="_base"/>
        <instance id="todoEntityDc" class="com.company.form.entity.TodoEntity">
            <fetchPlan extends="_base"/>
            <loader id="todoEntityDl"/>
  1. Add a form for the ToDoEntity instance:
<split orientation="horizontal" id="splitId">
    <form id="form" dataContainer="personDc">
       <column width="350px">
           <textField id="nameField" property="name"/>
           <textField id="ageField" property="age"/>
           <textField id="cityField" property="city"/>
       <button id="addTodoBtn" caption="Add TODO"/>
       <form id="todoForm" dataContainer="todoEntityDc" caption="TODO" editable="false">
           <column width="350px">
              <textField id="task1Field" property="task1"/>
              <textField id="task2Field" property="task2"/>
              <textField id="task3Field" property="task3"/>

I use a special button with addTodoBtn id for activating the form, by default it is not editable.
3. Open the PersonEdit controller and add the code below:

private Metadata metadata;
private InstanceContainer<TodoEntity> todoEntityDc;
private DataContext dataContext;
private Form todoForm;

public void onBeforeCommitChanges(BeforeCommitChangesEvent event) {
    TodoEntity todoEntity = todoEntityDc.getItem();

public void onAddTodoBtnClick(Button.ClickEvent event) {
    TodoEntity todoEntity = metadata.create(TodoEntity.class);

We use ClickListener of addTodoBtn to activate the form and create new instance of TodoEntity and add this instance to InstanceContainer. Also we use listener of BeforeCommitChangesEvent to add the TodoEntity to the DataContext.

Here is a result how it looks like: