This topic is locked
[SOLVED]

 Redirect

6/23/2011 1:20:25 AM
PHPRunner General questions
bbarker author

I've had problems before using the REDIRECT as an Event.
On the ADD page when I click on SAVE, it should

  1. save the new record and
  2. return to the LIST page.
    It SAVES okay, but STAYS on the ADD page. Can you see anything wrong here?



// After record added

function AfterAdd(&$values,&$keys,$inline)

{


//********** Redirect to another page ************

header("Location: tblvendors_list.php?a=return");

exit();

;

} // function AfterAdd
C
cgphp 6/23/2011

Bill B,
in the "After record added", you have only to insert the following code:



//********** Redirect to another page ************

header("Location: tblvendors_list.php?a=return");

exit();


Remove the function declaration. It's not necessary.
Cheers

CGphp

bbarker author 6/23/2011



in the "After record added", you have only to insert the following code:



//********** Redirect to another page ************

header("Location: tblvendors_list.php?a=return");

exit();



Remove the function declaration. It's not necessary.



That's exactly what I entered on the "After record added" page. Just those three lines (shown above). PhpRunner inserts the rest of it in the tblvendors_events.php file.

$this->events["AfterAdd"]=true;


// After record added

function AfterAdd(&$values,&$keys,$inline)

{



//********** Redirect to another page ************

header("Location: tblvendors_list.php");

exit();

;

} // function AfterAdd


Maybe this is why I've never had success with the REDIRECT command. Any more suggestions?

C
cgphp 6/23/2011

Enable firebug and check if something goes wrong before the redirection.

bbarker author 6/23/2011



Enable firebug and check if something goes wrong before the redirection.


Good suggestion. I enabled it but now I don't know what to look for.
Can someone tell me which tabs to have active?

C
cgphp 6/23/2011

Under "Net" check the response from the server.

Sergey Kornilov admin 6/23/2011

What Cristian says is that in Events Editor in PHPRunner you should only the following two lines:

header("Location: tblvendors_list.php");

exit();


Is that a regular Add page or you add both master and details on the same page? If latter, redirect in AfterAdd event won't work.

bbarker author 6/24/2011



Is that a regular Add page or you add both master and details on the same page? If latter, redirect in AfterAdd event won't work.


ARGHHHHHHHHH!!!!!!!! Dang it... Not again... Another exception!! <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=59015&image=1&table=forumreplies' class='bbc_emoticon' alt=':angry:' />
You know, one of the BEST things about PHPR is that it has the Master/Details dual display. But some of the most fundamental features DON'T WORK when you include the Details view. <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=59015&image=2&table=forumreplies' class='bbc_emoticon' alt=':blink:' />
And -- I'm sorry, but I'll be danged if I can ever find this "exception" mentioned in the Manual. PLEASE, PLEASE include more of these "notes" in a future update to the Manual. I've spent way too much time (again) searching for a solution only to find out that THERE WASN'T one. <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=59015&image=3&table=forumreplies' class='bbc_emoticon' alt=':unsure:' /> Darn it.
On the other hand, maybe there should be a new Chapter in the Manual that JUST LISTS the exceptions! I read the Manual a lot -- I really do, but if it's not there, then I'm just wasting my time, and eventually, YOURS. <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=59015&image=4&table=forumreplies' class='bbc_emoticon' alt=':D' />
PS. I'm not mad.. just frustrated that I spent so much time again on something that had a simple solution. (or rather non-solution). How about if the Manual gets moved into a WIKI? Then we could update it immediately....??!??

bbarker author 6/24/2011

If I removed the check mark on the ADD Page on this Properties page, would the REDIRECT work then?

Sergey Kornilov admin 6/24/2011

Yes, removing 'Add page' checkmark will do the job.
This is a quite logical limitation in fact. If you redirect right after master record is added PHPRunner won't be able to add details records. We'll find another way to make redirects work in one of the updates.

bbarker author 6/24/2011



Yes, removing 'Add page' checkmark will do the job.

This is a quite logical limitation in fact. If you redirect right after master record is added PHPRunner won't be able to add details records. We'll find another way to make redirects work in one of the updates.


Yes, of course, it's contrary to the master/details concept.... But, you've got enough interest in it now, that it would be a good feature to add to a future build. Thanks!
SOLUTION: After I unchecked the "Add Page" checkmark, then the REDIRECT now works on that page. As the Manual said it would. <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=59029&image=1&table=forumreplies' class='bbc_emoticon' alt=':)' />

Sergey Kornilov admin 6/24/2011

Just wanted to add - that was one of things we didn't see coming when we added an option to add and edit details on the same page. We will find a workaround.
PS. Wiki should be launched the next week. We need to pre-populate it with some content and prepare instructions for wiki editing.