This topic is locked

Redirect to master/details after save fro popup

6/15/2016 12:01:43 PM
PHPRunner Tips and Tricks
F
FunkDaddy author

When adding new master record via popup you can redirect to child records using newly created masterkey like this:
Add to JSOnLoad event of your popup add page


this.on('afterSave', function(respObj, formObj, fieldControlsArr, pageObj) {

console.log('masterkey: ' + respObj.keys[0]);

window.location.href = "households_tbl_list.php?mastertable=families_tbl&masterkey1=" + respObj.keys[0];

});


Make sure you don't have any other redirects already setup in your "Add new" settings options in PHPR to prevent conflicts of redirection. Choosing 'just close after adding in Popup Mode' OR using option "Return to the list page" will NOT conflict with code above.