Hi all,
I have built a form using the solutionModel based data held in a table. The form looks fine, but what strategies can I use to save the actual data of the form?
Ideally I would like to hook up fields from various related records. If that is not possible, I could use form variables, but at what point do I trigger a save – I will then need to copy the data from my form variables to the related records…
Any ideas or best practices?
Christian
Hi Christian,
I have used this approach in a couple of projects. But to answer your question well I need some more information.
Will the form have multiple records or only one? Do you need to be able to edit all the data or only some fields?
Also what problem are you really trying to solve ?
Hi Robert,
I worked out the missing bits. I needed to create a dataSource with
var source = dataset.createDataSource('source', [JSColumn.TEXT, JSColumn.TEXT, JSColumn.TEXT, JSColumn.TEXT]);
/** @type {JSForm} */
var a_form = solutionModel.newForm("some_name", source, 'some_style', false, 600, 300);
Then I have hooked up a method to “onEditStop”
a_form.onRecordEditStop = solutionModel.getGlobalMethod('globals', 'on_edit_stop');
In my global method I can access the dataSource I created by
var rec = forms["some_name"].foundset.getRecord(1);
and save the data that the users have input.
This seems to be working fine,
Christian