Custom Function Call by hyperlink from list page

SHANE

New member
Hi Eugenio,

Good Day!

Thank you for strong and prompt support.

I am looking for an option to execute below.

I have a hardcoded field/column say Action1 enabled on list page.

Feature of this field:
1. Hyperlinked field
2. Hyperlink includes id of that record,
3. Clicking the hyperlink passes the id and calls a custom function - for that row.

Is this possible using html/rich editor field?

Thanks in advance.

Regards.

#######

DaDaBIK version 8.0-Lerici enterprise
PHP Version: 5.6.19
mysql version: 5.7.11
Web server: Apache/2.4.18 (Win64) PHP/5.6.19
 

eugenio

Administrator
Staff member
Hello,
if you manage to add to the field value the id of the record you can use a custom formatting function, that receives the ID value, and build a link. The problem is that at the moment there isn't a built-it way to call a function through a link. You can call a custom page, not a custom function.

This feature, however, will be available in DaDaBIK 9 (you will be able to add a button to the results grid and link it to a custom function).

best,
 

SHANE

New member
Hi Eugenio,

Thanks for replying.

Sorry, i am not that tech savvy, with php.

Getting id on the field is easy, by sql. Let's say the field has id value copied to it.
Then, can you suggest how to go forward. In that case, how do i call a custom page through this link?

In the custom page, i suppose i can put the custom function that will be called and will use the id from the link.

I see, something i can use in the amazon images that you provided in the ERP demo application - but unfortunately i cannot see the code used there for custom formatting and validation functions.

(Check box and custom buttons on list/detail page, is something i have been looking forward to since last 2 years, since i started exploring Dadabik)

Regards,
Shane.
 

eugenio

Administrator
Staff member
Hello,
you have to build the custom page first; you will see the page in your menu. Click on the page just to see the URL of the page and copy it. Let's say the URL is index.php?function=show_static_page&id_static_page=5

In the form configurator assign a custom formatting function to the field, e.g. dadabik_format_id and then in custom_functions.php add the function, something like:

function dadabik_format_id($value){
return 'LINK';
}

the link will open the custom page in a new page passing the id of the record, that you will see in the custom page as $_GET['_cp_id']. Please note that anything you get via $_GET / $_POST is automatically escaped (if you have numeric IDs, this doesn't affect you).

Best,
 

SHANE

New member
Super!!

Let me work on this and hope i can achieve something usable, while waiting for version 9.

Thank you for your patience and support.

Warm Regards.
 
Top