Link to open form in modal on custom page

Discussions related to customizing hooks. Hooks are documented at http://bigprof.com/appgini/help/advanced-topics/hooks/
Post Reply
User avatar
jmcgov
Veteran Member
Posts: 81
Joined: 2018-12-19 01:31
Location: Northern Ireland

Link to open form in modal on custom page

Post by jmcgov » 2022-11-02 22:45

Hi AppGini’rs.
Is there a way to open a form, in a modal, from a link in a custom Page?
For new record and/or existing record?
TIA
Last edited by jmcgov on 2022-11-02 22:48, edited 1 time in total.

User avatar
jsetzer
AppGini Super Hero
AppGini Super Hero
Posts: 1817
Joined: 2018-07-06 06:03
Location: Kiel, Germany
Contact:

Re: Link to open form in modal on custom page

Post by jsetzer » 2022-11-02 22:47

Check AppGini's modal_window function in javascript. Use options.url.
Kind regards,
<js />

My AppGini Blog:
https://appgini.bizzworxx.de/blog

You can help us helping you:
Please always put code fragments inside [code]...[/code] blocks for better readability

AppGini 24.10 Revision 1579 + all AppGini Helper tools

User avatar
jmcgov
Veteran Member
Posts: 81
Joined: 2018-12-19 01:31
Location: Northern Ireland

Re: Link to open form in modal on custom page

Post by jmcgov » 2022-11-02 22:49

Thank you jsetzer, I’ll search for that function.

User avatar
jmcgov
Veteran Member
Posts: 81
Joined: 2018-12-19 01:31
Location: Northern Ireland

Re: Link to open form in modal on custom page

Post by jmcgov » 2022-11-08 12:10

I've made progress on this, thanks, but there seems to be something tricky...
In a nutshell
- I have a custom page that displays data and contains a link to open the data record for edit, in a modal (works OK)
- I update the record, click save button (to update the record and close the modal) (works OK)
- I'm trying to use the "close" attribute of modal to do an AJAX refresh (refreshContact) of the data on custom page (not OK, see below)

It seems that the AJAX function is being called before the record is updated (probably on initial page load) - Modal options settings below

let options = {
url: table_name + "?SelectedID=" + SelectedID + "&Embedded=1",
id: "modal" + button_id,
size: 'full',
close: refreshContact(SelectedID),
title: heading
};
modal_window(options);

Am I misunderstanding the purpose of the "close" option?? I.E. to trigger the named function when the modal is closed
PS - I figured out this function by finding the actual function (in common.js), but is there documantation for it?

User avatar
jmcgov
Veteran Member
Posts: 81
Joined: 2018-12-19 01:31
Location: Northern Ireland

Re: Link to open form in modal on custom page

Post by jmcgov » 2022-11-09 09:39

Hi
I have figured this out, thanks to another poster (Ahmed, no less), TY
viewtopic.php?f=8&t=2501&p=16397&hilit= ... b24#p16397
I was loading the close function incorrectly. Code as below, :)

let options = {
url: table_name + "?SelectedID=" + SelectedID + "&Embedded=1",
id: "modal" + button_id,
size: 'full',
close: function() {
location.reload();
},
title: heading
};

Post Reply