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?
Stay on record after add new
Re: Stay on record after add new
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.
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.
Re: Stay on record after add new
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#";
Find this line : $x->RedirectAfterInsert = "yourtablename_view.php;
And change to this : $x->RedirectAfterInsert = "yourtablename_view.php?SelectedID=#ID#";
23.17