Let's say you want to add a Save and back to list button on the Edit page which should take you back to the list page after record is saved.

Here is how this can be done:

PHPRunner 5.0-5.2:

1. In Visual Editor create a copy of the Save button
Switch to HTML mode and modify new button label and ID
Quote
<INPUT class=button id=submit2 type=submit value="Save and back to list" name=submit2>



2. Implement AfterEdit event:
Quote
if ($_REQUEST["submit2"]=="Save and back to list")
{
header("Location: cars_list.php");
exit();
}



PHPRunner 5.3-6.x:

1. In Visual Editor create a copy of the Save button
Switch to HTML mode and modify new button label and ID
Quote
<INPUT class=button id=submit2 type=button value="Save and back to list" name=submit2>


2. process this button in the Javascript onload event on the Events tab:
Quote
$("#submit2").bind("click", {page: this}, function(e){
var page = e.data.page;
page.on('beforeSave', function(formObj, fieldControlsArr, pageObj){
formObj.baseParams['submit2'] = 'Save and back to list';
}, page, {single: true});
page.on('afterSave', function(respObj, formObj, fieldControlsArr, pageObj){
delete formObj.baseParams['submit2'];
}, page, {single: true});
page.saveHn(e);
});


3. Implement AfterEdit event:
Quote
if ($_REQUEST["submit2"]=="Save and back to list")
{
header("Location: cars_list.php");
exit();
}




Kalau Tidak Bisa
Try this:

if ($_REQUEST["submit2"]=="Save and back to list")
{
header
("Location: carsadmin_cars_list.php");
exit();
}

Post a Comment