# showformInDialog not working

**URL:** <https://forum.servoy.com/t/showformindialog-not-working/9277>\
**Category:** Classic Servoy\
**Created:** [July 10, 2008, 12:33am UTC](https://forum.servoy.com/t/showformindialog-not-working/9277 "2008-07-10T00:33:52Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![davidaarong](https://avatars.discourse-cdn.com/v4/letter/d/13edae/32.png) [@davidaarong](https://forum.servoy.com/u/davidaarong)\
**Post date:** [July 10, 2008, 12:33am UTC](https://forum.servoy.com/t/showformindialog-not-working/9277/1 "2008-07-10T00:33:52Z")

</div>

I have a form displayed as a list view a button on the left side that launches the following method

```auto
application.showFormInDialog(forms.popup_comment,-1,-1,-1,-1,'Comment',true,false,'Status Legend',true);

```

Which works

But when I place this layout on a tab panel and click on the button to launch the method it will only show one record, no matter which row i click on.

For example, if i first click on the first row (“indy”) below, the correct record will show (“indy”) in showFormInDialog. However, when i go to click on the 2nd row “star wars”, the showFormInDialog will launch and still show “indy”.

Icon\_\_\_\_ID\_\_\_\_\_Commment  
\_x\_\_\_\_\_\_1\_\_\_\_\_\_\_indy  
\_x\_\_\_\_\_\_2\_\_\_\_\_\_\_star wars  
\_x\_\_\_\_\_\_3\_\_\_\_\_\_\_the empire strikes back

any ideas?

David

Details:  
OS: Windows XP SP2  
Servoy: Version 3.5.6-build 519

Main Layout is based on table: core\_rso\_emp  
TabPanel Layout is based on table: core\_rso\_comment

Relationship based on the emplid column in main table (core\_rso\_emp)  
core\_rso\_emp to core\_rso\_comment  
emplid ---------\< emplid

---

<div class="post-metadata">

**Author:** ![jcompagner](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/jcompagner/32/4889_2.png) [@jcompagner](https://forum.servoy.com/u/jcompagner)\
**Post date:** [July 10, 2008, 11:09am UTC](https://forum.servoy.com/t/showformindialog-not-working/9277/2 "2008-07-10T11:09:50Z")

</div>

does forms.popup\_comment has the same relation in it that the tab panel where you click on?

forms.popup\_comment.controller.loadRecord(tabpanel.foundset)  
// show

---

<div class="post-metadata">

**Author:** ![davidaarong](https://avatars.discourse-cdn.com/v4/letter/d/13edae/32.png) [@davidaarong](https://forum.servoy.com/u/davidaarong)\
**Post date:** [July 11, 2008, 6:11pm UTC](https://forum.servoy.com/t/showformindialog-not-working/9277/3 "2008-07-11T18:11:05Z")

</div>

Hi Johan,

I don’t understand your question.

I have a Form based on a comment table and an icon in one column that lauches a method with the following code:

```auto
application.showFormInDialog(forms.popup_comment,-1,-1,-1,-1,'Comment',true,false,'Status Legend',true);

```

Which works. But when I place this form in a tab it doesn’t work. The tab shows the correct records that are related, but when i launch the method it doesn’t show the correct record in the showFormInDialog

The relationship to actually place the tab on the other form is correct, since the correct related records are displayed.

---

<div class="post-metadata">

**Author:** ![davidaarong](https://avatars.discourse-cdn.com/v4/letter/d/13edae/32.png) [@davidaarong](https://forum.servoy.com/u/davidaarong)\
**Post date:** [July 11, 2008, 7:20pm UTC](https://forum.servoy.com/t/showformindialog-not-working/9277/4 "2008-07-11T19:20:21Z")

</div>

Here is the screen shot of the form, from which the methdo works just fine:

Here is the screen shot in which the same form is used in a tab panel, but notice which row is highlighted in the background and which record is actually shown in the dialog pop-up:

---

<div class="post-metadata">

**Author:** ![kurtbleicken](https://avatars.discourse-cdn.com/v4/letter/k/c57346/32.png) [@kurtbleicken](https://forum.servoy.com/u/kurtbleicken)\
**Post date:** [July 14, 2008, 1:10pm UTC](https://forum.servoy.com/t/showformindialog-not-working/9277/5 "2008-07-14T13:10:13Z")

</div>

One way to solve this is with an onAction method that loads that line item record’s primary key into a global. Then finds that record using the global, then shows the FID.

This is pretty bombproof but there may be a more elegant solution.

Hope this is helpful. K

---

<div class="post-metadata">

**Author:** ![david](https://avatars.discourse-cdn.com/v4/letter/d/aeb1de/32.png) [@david](https://forum.servoy.com/u/david)\
**Post date:** [July 14, 2008, 6:32pm UTC](https://forum.servoy.com/t/showformindialog-not-working/9277/6 "2008-07-14T18:32:36Z")

</div>

What Johan is saying is that your tab panel form and form in dialog form need to share the same foundset to show the same records.

Forms based on the same table share the same foundset unless:

1. when the source and/or destination form has the “useSeparateFoundSet” property checked
2. when the source and/or destination form is being viewed through a relationship

In your case, one of your forms if viewed through a relationship (the tab panel one), and your form in dialog form is not.

So you need to transfer the foundset from the tab panel form to your form in dialog form:

forms.dialogFormName.controller.loadRecords(forms.tabFormName.foundset)

---

<div class="post-metadata">

**Author:** ![davidaarong](https://avatars.discourse-cdn.com/v4/letter/d/13edae/32.png) [@davidaarong](https://forum.servoy.com/u/davidaarong)\
**Post date:** [July 14, 2008, 11:57pm UTC](https://forum.servoy.com/t/showformindialog-not-working/9277/7 "2008-07-14T23:57:33Z")

</div>

Hi David,

Ok, so how exactly do i transfer the foundset to the tab panel?

Main Form name is: **form\_RSO\_Customers\_Details**  
Relationship from Main form to tab is: **core\_rso\_emp\_to\_core\_rso\_comment**

Tab panel form name is: **tab\_comments**

The button that launches the method is on the form named **tab\_comments**

---

<div class="post-metadata">

**Author:** ![IT2Be](https://avatars.discourse-cdn.com/v4/letter/i/dc4da7/32.png) [@IT2Be](https://forum.servoy.com/u/IT2Be)\
**Post date:** [July 15, 2008, 6:03am UTC](https://forum.servoy.com/t/showformindialog-not-working/9277/8 "2008-07-15T06:03:06Z")

</div>

forms.yourformname.controller.loadRecords(nameofyourfoundsetorrelationorwhatever).

This is documented btw ![:)]( "Smile")

---

<div class="post-metadata">

**Author:** ![davidaarong](https://avatars.discourse-cdn.com/v4/letter/d/13edae/32.png) [@davidaarong](https://forum.servoy.com/u/davidaarong)\
**Post date:** [July 15, 2008, 7:45pm UTC](https://forum.servoy.com/t/showformindialog-not-working/9277/9 "2008-07-15T19:45:50Z")

</div>

so yeah… i checked the manual and still can’t this to work correctly…

here’s the code:

> forms.form\_RSO\_Customers\_Details.core\_rso\_emp\_to\_core\_rso\_comment.loadRecords(foundset)
> 
> application.showFormInDialog(forms.popup\_comment,-1,-1,-1,-1,‘Comment’,true,false,‘Comment’,true);

-david

---

<div class="post-metadata">

**Author:** ![IT2Be](https://avatars.discourse-cdn.com/v4/letter/i/dc4da7/32.png) [@IT2Be](https://forum.servoy.com/u/IT2Be)\
**Post date:** [July 15, 2008, 9:00pm UTC](https://forum.servoy.com/t/showformindialog-not-working/9277/10 "2008-07-15T21:00:41Z")

</div>

what is this: ore\_rso\_emp\_to\_core\_rso\_comment ?

Is it a relation?

When you want to load records into a form it should be:  
forms.form\_RSO\_Customers\_Details.ccontroller.loadRecords(foundset)

---

<div class="post-metadata">

**Author:** ![jcompagner](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/jcompagner/32/4889_2.png) [@jcompagner](https://forum.servoy.com/u/jcompagner)\
**Post date:** [July 17, 2008, 12:04pm UTC](https://forum.servoy.com/t/showformindialog-not-working/9277/11 "2008-07-17T12:04:09Z")

</div>

you are still seem to set it the wrong way around  
you are showing the form: forms.popup\_comment

so what you should right before your show form code:

forms.popup\_comment.controller.loadRecord(tabpanel.foundset)

it seems that you try to do it the other way around…

that tabpanel.foundset should then be the foundset/relation of that tabpanel that you want to see

So if you are in the tabpanels itself where you do show dialog you can just do:

forms.popup\_comment.controller.loadRecord(foundset)

if you are somewhere else for example in the parent form of the tabpanel you should do something like this:

forms.popup\_comment.controller.loadRecord(this\_is\_the\_tab\_relation)

then do

application.showFormInDialog(forms.popup\_comment,-1,-1,-1,-1,‘Comment’,true,false,‘Comment’,true);

---

<div class="post-metadata">

**Author:** ![davidaarong](https://avatars.discourse-cdn.com/v4/letter/d/13edae/32.png) [@davidaarong](https://forum.servoy.com/u/davidaarong)\
**Post date:** [July 18, 2008, 10:33pm UTC](https://forum.servoy.com/t/showformindialog-not-working/9277/12 "2008-07-18T22:33:13Z")

</div>

thanks for the replies,

I got it to work with this:

```auto
forms.popup_comment.controller.loadAllRecords();
forms.popup_comment.controller.find();
forms.popup_comment.core_rso_comment_id = core_rso_comment_id;
forms.popup_comment.controller.search();

application.showFormInDialog(forms.popup_comment,-1,-1,-1,-1,'Comment',true,false,'Comment',true);

```
