This topic is locked

Adding save, to listpage, next page, to top of page

10/26/2011 6:08:42 PM
PHPRunner Tips and Tricks
ncreveld author

Hi friends and admin,
This was a very nice solution in phprunner 5.3 but how should this be done in phprunner 6 ?
Nico Creveld <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=question&id=18025&image=1&table=forumtopics' class='bbc_emoticon' alt=':rolleyes:' />
=================================

Update for PHPRunner5.3:

  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();

    }