Stay on record after add new

If you're a new user of AppGini, feel free to ask general usage questions, or look for answers here.
Post Reply
thecomputerchap
Veteran Member
Posts: 47
Joined: 2016-08-28 10:37

Stay on record after add new

Post by thecomputerchap » 2017-08-03 17:51

Hi all,

By default, AppGini will redirect back to the table view after adding a new record. This is normally great, however I really need it to remain on the new record detail view after adding the new record. This is because I need to then add child records relating to the parent record as soon as the new parent record is created. This needs to apply to 2 tables within my application.

I tried messing about with the RedirectAfterInsert Datalist option in tablename_init() but since there is no SelectedID at this point I can not use it.

Does anyone else have a hook suggestion to prevent redirecting back to table view after inserting a new record?

peebee
AppGini Super Hero
AppGini Super Hero
Posts: 352
Joined: 2013-03-21 04:37

Re: Stay on record after add new

Post by peebee » 2017-08-04 01:17

There is a built in "Redirect After Insert" function in the options of every table - see screenshot below.

Place your cursor in the Redirect After Insert text box and hit the F1 key for the popup help dialogue.

I haven't tried it myself but I see the help dialogue indicates "If you add the characters #ID# as part of the web address, they will get replaced by the primary key value of the newly inserted record." Should very easily solve your problem.
screenshot-2.jpg
screenshot-2.jpg (101.06 KiB) Viewed 3598 times

patsd102
Veteran Member
Posts: 142
Joined: 2013-01-15 19:59

Re: Stay on record after add new

Post by patsd102 » 2017-08-06 07:47

Go to your table php page "yourtable_view.php

Find this line : $x->RedirectAfterInsert = "yourtablename_view.php;

And change to this : $x->RedirectAfterInsert = "yourtablename_view.php?SelectedID=#ID#";
23.17

Post Reply