This topic is locked
[SOLVED]

Redirection to another page does not work when pressing a key to Save.

2/10/2022 8:58:30 AM
PHPRunner General questions
D
dannyschaepdrijver authorDevClub member

I added some code in the 'JavaScript Onload event' to save the page after pressing F9 key.

When after saving, I want to redirect to another page (which is a different table), the program is returning to the default page.
Where or how do I have to solve this problem ?

// IF keyboard code 'F9' is pressed the form is saved
//****
$(document).keydown(function(e)
{
if(e.which == 120)
{
$("[id^=saveButton]").click();
return true;
location.href = 'dbo_ds_PHP_RoutingSource_Prod_list.php';

}
}
);

Sergey Kornilov admin 2/10/2022

Your redirect code will never run. Once button is clicked the built-in saving mechanism will be triggered and user will be redirected to the page specified in project settings (by default it will stay on the Edit page).

If you need to perform a rediect, you need to do that in AfterEdit event