Page 1 of 1

Stay on record after add new

Posted: 2017-08-03 17:51
by thecomputerchap
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?

Re: Stay on record after add new

Posted: 2017-08-04 01:17
by peebee
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 3662 times

Re: Stay on record after add new

Posted: 2017-08-06 07:47
by patsd102
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#";