# Editing Portal Row in a Dialog

**URL:** <https://forum.servoy.com/t/editing-portal-row-in-a-dialog/5802>\
**Category:** Classic Servoy\
**Created:** [April 24, 2006, 1:42pm UTC](https://forum.servoy.com/t/editing-portal-row-in-a-dialog/5802 "2006-04-24T13:42:15Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![4xjbh](https://avatars.discourse-cdn.com/v4/letter/4/ea666f/32.png) [@4xjbh](https://forum.servoy.com/u/4xjbh)\
**Post date:** [April 24, 2006, 1:42pm UTC](https://forum.servoy.com/t/editing-portal-row-in-a-dialog/5802/1 "2006-04-24T13:42:15Z")

</div>

I use this to edit the address record in a dialog, activated from a method in a list view and all works well. Now experimenting with portals I am unable to work out how to edit the selected row in a dialog.

```auto
forms.address_edit.controller.loadRecords(foundset);
application.showFormInDialog(forms.address_edit.............

```

What **functions** do I use to pass the selected record foundset to the next.

Thanks

---

<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:** [April 24, 2006, 2:42pm UTC](https://forum.servoy.com/t/editing-portal-row-in-a-dialog/5802/2 "2006-04-24T14:42:47Z")

</div>

When you coding is correct ![:)]( "Smile") the selected record is always ‘held’ in the foundset. So, when you ‘move’ a foundset from one form to the other the selected record remains the same.

BTW when you use the same foundset on a number of different records you don’t have to ‘move’ the foundset. It will be the same everywhere including the same record.

---

<div class="post-metadata">

**Author:** ![patrick](https://avatars.discourse-cdn.com/v4/letter/p/b2d939/32.png) [@patrick](https://forum.servoy.com/u/patrick)\
**Post date:** [April 24, 2006, 8:19pm UTC](https://forum.servoy.com/t/editing-portal-row-in-a-dialog/5802/3 "2006-04-24T20:19:52Z")

</div>

When your coding is not that correct ![:wink:]( "Wink") because you might use your dialog in all kinds of situations, you could do a simple method that shows the dialog and one that calls it. For example,

```auto
// showDialog
var vId = arguments[0],
      vFoundset = arguments[1];

if (!vFoundset) { // just shows that one record
   controller.find();
   id_column = vId;
   controller.search();
}
else { // loads the foundset and jumps to the record
   controller.load(vFoundset);
   controller.selectRecord(vId);
}
application.showFormInDialog(mySelf);

```

And

```auto
// showDetail
forms.myDialog.showDialog(id_column, foundset); // pass record id and foundset

```

Like this, you can all this dialog from everywhere if you know which record you want to show.

---

<div class="post-metadata">

**Author:** ![4xjbh](https://avatars.discourse-cdn.com/v4/letter/4/ea666f/32.png) [@4xjbh](https://forum.servoy.com/u/4xjbh)\
**Post date:** [April 25, 2006, 2:06am UTC](https://forum.servoy.com/t/editing-portal-row-in-a-dialog/5802/4 "2006-04-25T02:06:03Z")

</div>

Hi,

I was unable to get your solution to work and I don’t understand why. I tinkered some more and tried the following code:

```auto
var tabindex = forms.companies.elements.tabs_data.tabIndex;
var tabname = forms.companies.elements.tabs_data.getTabTextAt(tabindex);

databaseManager.startTransaction()

switch (tabname)
{
case "Diary Notes":
	forms.diary_editDialog.controller.loadRecords(companies_to_diary); 
	application.showFormInDialog(forms.diary_editDialog,-1,-1,-1,-1,'Edit Diary Entry',false,false,true);
	break;
case "Employees":
	plugins.dialogs.showDialog('Alert','To be coded: '+tabname,'OK')
	break;
case "Projects":
	plugins.dialogs.showDialog('Alert','To be coded: '+tabname,'OK')
	break;
case "Address":
	plugins.dialogs.showDialog('Alert','To be coded: '+tabname,'OK')
	break;
}

```

This works with this form for editing a diary note…my desired result, but am I over simplfying it or should I just shutup and count my blessings?

---

<div class="post-metadata">

**Author:** ![patrick](https://avatars.discourse-cdn.com/v4/letter/p/b2d939/32.png) [@patrick](https://forum.servoy.com/u/patrick)\
**Post date:** [April 25, 2006, 5:48am UTC](https://forum.servoy.com/t/editing-portal-row-in-a-dialog/5802/5 "2006-04-25T05:48:01Z")

</div>

hmm. But this is a completely different solution. What if you need to show more than one field? What haven’t you been able to accomplish? Can you post your code?

---

<div class="post-metadata">

**Author:** ![4xjbh](https://avatars.discourse-cdn.com/v4/letter/4/ea666f/32.png) [@4xjbh](https://forum.servoy.com/u/4xjbh)\
**Post date:** [April 25, 2006, 6:03am UTC](https://forum.servoy.com/t/editing-portal-row-in-a-dialog/5802/6 "2006-04-25T06:03:53Z")

</div>

Attached are the forms I have created. I select the row i wish to edit and select the \> button and up pops the dialog with fields ready for data entry.

> What if you need to show more than one field?

I do not understand this this question! More than one field is displayed

James

 ![Edit Diary Dialog.jpg](https://canada1.discourse-cdn.com/flex010/uploads/servoy/original/2X/f/f813a7aaddce4fcee1174d43193872f43cdfa583.jpeg)

 ![Diary.jpg](https://canada1.discourse-cdn.com/flex010/uploads/servoy/original/2X/0/0b09eef7be42ed4fb7e857c21d21fe313c2c1cf6.jpeg)

---

<div class="post-metadata">

**Author:** ![patrick](https://avatars.discourse-cdn.com/v4/letter/p/b2d939/32.png) [@patrick](https://forum.servoy.com/u/patrick)\
**Post date:** [April 25, 2006, 7:34am UTC](https://forum.servoy.com/t/editing-portal-row-in-a-dialog/5802/7 "2006-04-25T07:34:55Z")

</div>

I haven’t read your post well enough. I only saw plugins.dialogs.showDialog(). Your code looks good, so now you have a solution and no problems anymore?

---

<div class="post-metadata">

**Author:** ![4xjbh](https://avatars.discourse-cdn.com/v4/letter/4/ea666f/32.png) [@4xjbh](https://forum.servoy.com/u/4xjbh)\
**Post date:** [April 25, 2006, 7:41am UTC](https://forum.servoy.com/t/editing-portal-row-in-a-dialog/5802/8 "2006-04-25T07:41:37Z")

</div>

Yes, thanks.

Now to work out hoe to display a month calender etc similar to outlook.

Chow.

---

<div class="post-metadata">

**Author:** ![patrick](https://avatars.discourse-cdn.com/v4/letter/p/b2d939/32.png) [@patrick](https://forum.servoy.com/u/patrick)\
**Post date:** [April 25, 2006, 7:42am UTC](https://forum.servoy.com/t/editing-portal-row-in-a-dialog/5802/9 "2006-04-25T07:42:29Z")

</div>

Have a look at HTML for that. Have fun!
