First, I hope the translation of this is good…
I think the point of the .toObject() and .fromObject() is to create an object you can pass in $form that allows you to add other objects such as a button, listbox, etc. Otherwise you could do:
On “inputForm” you could include whatever fields you like. However, you could not add anything else that used Form. This may or may not be useful.
I prefer to use a subform for the ‘input form’. This way I use the ‘parent form’ for other things. Perhaps showing some choice lists? Or providing look up functions? For example:
This is much more flexible. You create an input/edit form for [MyTable] and load it into the subform. Set the subform as an object type and its data source as Form.subform_o. This populates the subform instance of Form with Form.subform_o.
The benefit of this design is the input form (used as the subform) is very simple. You can manage all the complicated validation, error checking, lookups, etc. on the parent form, if you like. You could also save the record with the parent form and, of course, create more than one new record.
This is a great way to create a data browser too - a listbox on the parent form can show an entity selection list. When you click on one of them the selected entity can appear in the same detail subform from above. This allows creating a sophisticated display which required dozens of lines of code in classic 4D and can be done with zero code in ORDA. It’s really quite remarkable.