Hello,
I have one form which displays data from a database table. This form has the namedFoundSet set to DEFAULT.
I want to open in a modal dialog another form that user the same data source, same table and same record. For this one I also use namedFoundSet as DEFAULT. I open it using the application.showFormInDialog method.
The problem is that the modal form shows data from a different record that the one in the first form. And it shows as in below image
[attachment=1]ModalForm.PNG[/attachment]
I tried to call this, before showing the form
forms.modal_form.foundset.loadRecords(record_id);
application.showFormInDialog(forms.modal_form, undefined, undefined, 322, 170, "", true, false, "", true);
But for a new record this doesn’t work. The forms look like this. As you can see, the data do not corresponds from one to the other. I checked the foundset of the modal form and it has no records in it. This is weird!
[attachment=0]ModalForm2.PNG[/attachment]
The first field where is typed “00:00” it’s a variable. But the checkboxes are related with fields in the database. I can’t do any action on them although they are enabled. If I try to press them to check them, nothing will happened and they remain unchecked. I think this is normal because the foundset is empty. But why it is empty? It has the namedFoundSet as DEFAULT so it should be related with the foundset from the first form and thus display the same data.
How can I see the same data from a record in multiple forms in the same time, especially if one of the form is presented in a modal dialog?
Thanks,
Bogdan.

Hi Bogdan,
It seems your foundsets are no longer shared.
How do you load the data in the original form (not the modal one)?
Hello,
The initial form that I described earlier is an edit/details for an entry in the database table. I have another form with List View for the records of that table.
The List View form and the Edit /Details form are both placed in a tabpanel with the same relation on each of them. The data is loaded based on that relation. I think also the selection.
Also both have the namedFoundSet set to default. This works well. Each time I double click in the List View I change the tabIndex in the panel that holds the two forms, and the Edit form shows the correct information without calling the loadRecords on the foundset.
When I’m adding a new record, I first call
databaseManager.setAutoSave(false);
form.edit_form.newRecord();
Then, at then end when user save I commit the changes through a transaction.
But the problem is while I’m in the Edit form, when I want to display that modal dialog, which has the same data source as the other two forms, the list one and the edit one. The modal dialog it’s used also for editing the data in the record, but I need to do it in a modal dialog because that is some special data that is not supposed to be edited anyway and I also provide a warning before the modal dialog is displayed.
Thanks,
Bogdan.
Hi Bogdan,
You say you display the list and detail forms via a relationship. The modal dialog of course will not use that relationship.
What you could do is to first create the new record and then pass the foundset to the modal dialog form like so:
databaseManager.setAutoSave(false);
controller.newRecord();
forms.modal_form.foundset.loadRecords(foundset);
application.showFormInDialog(forms.modal_form, -1, -1, 322, 170, "", true, false, "", true);
Hope this helps.
Hello,
This is what I’m doing, well not all at once, but when the Edit form is shown, in case a new record has to be added I call the first two lines, then when the user press on a button in the Edit form I call the other two, to display the Modal dialog. This works if the record was already added, but for a completely new record doesn’t work. After a new record has been saved it works.
I’ll try to test it better.
Thanks,
Bogdan.
best thing to do is always to be explicit in what you want:
forms.modal_form.loadRecords(forms.myeditfform.foundset)
application.showFormInDialog(forms.modal_form, undefined, undefined, 322, 170, “”, true, false, “”, true);
Now they should be in sync