This topic is locked

Button From View Page to Report

12/30/2013 1:26:53 AM
PHPRunner General questions
D
dclex author

Hello,
I am wanting a button on the view page that will take the user to a report that is sorted by their id. I have tried the following and needing help.
Client Before:

params["ScheduleID"]="ScheduleID";
Server:

$record = $button->getCurrentRecord();

$result["ScheduleID"]=$record["ScheduleID"];
Client After:

location.href='Page_report.php?q=(ScheduleID~equals~'+result["ScheduleID"];
Thank you

Sergey Kornilov admin 12/30/2013

ClientBefore code doesn't make any sense, feel free to get rid of it.
The rest of code looks like it might work (except for the missing closing parenthesis). What exactly is happening when you click that button?

D
dclex author 12/30/2013

I removed the Client Before.
I changed to the following with ending parenthesis. Thank you for the catch.
location.href='http://www.mysite.com/999/My_view.php?q=(ScheduleID~equals~+result["ScheduleID"])';;
When I click on the button, the address bar changes from:
http://www.mysite.com/999/My_view.php?editid1=83
to
http://www.mysite.com/999/999/My_view.php?editid1=83#
and stays on the current page.
Thanks

Sergey Kornilov admin 12/30/2013

You original ClientAfter code looks right because it uses report page URL. Besides that your new Javascript code won't work. You have removed the single quote after ~ character which is wrong.
Try something like this:

location.href='Page_report.php?q=(ScheduleID~equals~'+result["ScheduleID"]+')';
D
dclex author 12/30/2013

Sergey, That worked. Thank you for answering the question. Learning to use phprunner and coding is an enjoyable process. Your patients is appreciated.
I did find another issues. I am using chrome and after changing the code, it would appear the browser cache did not refresh the button code. For the button to work, I had to refresh the page several times. Is this likely and if so, how can we force a refresh when changes to the site occur?
Thank you again.

Sergey Kornilov admin 12/30/2013

You need to hit CTRL+F5 to fully reload the page or, better yet, cleat browser's cache via CTRL+SHIFT+DEL.
Other users won't have this issue since they don't have a previous version in their cache.