I’ve got a portal on a form, with an ‘Add’ and ‘Delete’ button at the top for adding/removing portal rows.
However, what I would like to do is emulate Filemaker’s portals a little bit more, so that portal rows are automatically created. I setup an onFocusLost method on the last field of the portal to create another portal row; That way you can just tab along filling in the columns, and when you tab out of the last one it makes a new row and you just continue on without having to go up and click a button each time.
However, this also means if someone clicks in the last column and then clicks anywhere else for any reason, it makes another new row.
I would like to filter the event so that ONLY if you hit the Tab key in the field does it make a new portal row. But I can’t seem to find any way to determine that. Am I missing anything?
My only other idea is to have a onRecordEditStop method for the form which goes through and deletes blank portal rows, but that seems rather hacky and inelegant.
Hi
Be very careful about automatically creating portal rows like FMP. I too wanted to do this when first moving to servoy before seeing the error of my ways. You can end up with empty records all over the place, that you somehow have to deal with.
What i do is fire a method “on focus lost” of the last field in the row to determine if there are more rows and if so tab into the first field of the next row underneath. I also have a method “on action” of the same field to determine if it is the last row of the table. If it is it will create a new record and tab into the first field of this new row.
This gives you the best of both worlds (in my opinion) as tabbing through fields will move you through rows, but if you hit the “enter” key on the last field of the last row you will create a new row if you require (no mouse clicks). User have picked it up very quickly.
Also i advise not to use portals for data entry!! most developers use table/list view in a tabless tab panel. this is far superior/powerful and more responsive.
The only time i use portals is to show non-editable related data
rodneysieb:
Hi
Be very careful about automatically creating portal rows like FMP. I too wanted to do this when first moving to servoy before seeing the error of my ways. You can end up with empty records all over the place, that you somehow have to deal with.
Absolutely true. And the reason is simple: FM doesn’t create anything until some field in the “ghost” line is filled and the record is committed (btw: this feature is often confusing the user, exactly for that reason).
Mimic a feature like this in Servoy is an error-prone procedure (unless you make use of some workaround like using globals etc).
Anyway, I don’t think is a good idea to implement something like that (only my 2 cents, of course).