This topic is locked
[SOLVED]

 Click Event - URL Field

8/20/2017 1:50:39 PM
PHPRunner General questions
S
salus1 authorDevClub member

Hi,

Is there a way to have a List page field level Click Event that opens a url in a pop-up where the url is pulled from a database field?

Thanks

admin 8/21/2017

You can implement a custom click event and in that event choose 'Run AJAX snippet' and in that snippet use displayPopup() function to open URL in popup.
https://www.xlinesoft.com/phprunner/docs/list_page_settings.htm

https://www.xlinesoft.com/phprunner/docs/index.htm?events.htm

S
salus2 8/21/2017

Thanks for this info. What is the correct syntax to reference the database field with the URL in it?
var win = Runner.displayPopup( {

url: "DATABASEFIELD",

width: 700,

height: 500,

});

admin 8/22/2017

See code examples at the end of this article, they show how you can access field values in ClientBefore and ClientAfter event:

https://www.xlinesoft.com/phprunner/docs/list_page_settings.htm

S
salus2 8/22/2017

OK, so the following Ajax Snippet works on a List View text field to open the URL in the Certificate field...
var win = Runner.displayPopup( {

url: row.getFieldValue("Certificate"),

width: 800,

height: 1000,

header: 'GIA Grading Report',

footer: '<a href="#" onclick="window.win.close();">Close window</a>',

afterCreate: function(win) {

window.win = win;

}

});

return false;
.. but this only works if the Certificate field is included in the List View. I'd like to hide the Certificate field, is there a way to reference a database field not on the List View?
Thanks

H
Hertz2P 8/22/2017



OK, so the following Ajax Snippet works on a List View text field to open the URL in the Certificate field...
var win = Runner.displayPopup( {

url: row.getFieldValue("Certificate"),

width: 800,

height: 1000,

header: 'GIA Grading Report',

footer: '<a href="#" onclick="window.win.close();">Close window</a>',

afterCreate: function(win) {

window.win = win;

}

});

return false;
.. but this only works if the Certificate field is included in the List View. I'd like to hide the Certificate field, is there a way to reference a database field not on the List View?
Thanks


Try keeping it in the list view, but delete the field column in the editor. This has worked in that situation for me before. If it doesn't work, you can always reset the page.

S
salus2 8/23/2017

Did not think of that.
Thanks!