CUSTOM FORMATTING FUNCTIONS Example

steff

New member
Hello,
i am a dadbik beginner. I tried the CUSTOM FORMATTING FUNCTIONS.

I have a table with a timestamp (date_time field).

i put in the forms generator field "Custom formatting function:" the example function (within the customs_functions.php).

=> dadabik_format_last_name_customer($value)

This ist the example function. I removed the comment markers.

function dadabik_format_last_name_customer($value){
return '<span style="color:red">'.$value.'</span>';
}

I got the error message:

Warning: call_user_func() expects parameter 1 to be a valid callback, function 'dadabik_format_last_name_customer($value)' not found or invalid function name in /var/www/....../include/business_logic.php on line 0

I have no idea. Thanks for Help.

--------------
You are using DaDaBIK version 9.2.2-Monterosso enterprise, installed on 09.03.2019 (installation code: ), the latest version of DaDaBIK is 9.2.2-Monterosso released on 05.03.2019
You are runnning the last release of DaDaBIK
PHP Version: 7.2.15-0ubuntu0.18.04.1
mysql version: 5.7.25-0ubuntu0.18.04.2
Web server: Apache/2.4.38 (Ubuntu)
 

FRW

Well-known member
Hi Steff,

Within the form configurator you only have to put the name of the function you would like to call: "dadabik_format_last_name_customer" - "$value" is the value that will come from the field.

F.e.:
you will type "test" in the field, wich has "dadabik_format_last_name_customer" as a formating function. So the value "test" will go into the function and will become "red".

(...all above withou the quotation marks...)
 

steff

New member
Ok, Thanks it works.

It is possible to format a timestamp? I have a timstamp field called TSTAMP. In front end i see for example "2019-03-11 19:35:04"

I wanna only see "2019-03-11" or "2019". A function like dadabik_format_TSTAMP($value) { return $value= date('d.m.Y', $value) }

Is this possible, or a calculated field (but there works only text fields...?)....
 

FRW

Well-known member
Hi Steff,

just make a try - dadabik won't hurt ;-)

Something like:

[pre]
function dadabik_timestamp_to_date ($value){

$value2 = date('d.m.Y H:i:s', $value);
return $value2;
}
[/pre]

will work as a formatting function
 

steff

New member
FRW Wrote:
-------------------------------------------------------
> Hi Steff,
>
> just make a try - dadabik won't hurt ;-)
>
> Something like:
>
> [pre]
> function dadabik_timestamp_to_date ($value){
>
> $value2 = date('d.m.Y H:i:s', $value);
> return $value2;
> }
> [/pre]
>
> will work as a formatting function

dadabik hurt me ;-)
Notice: A non well formed numeric value encountered .... the result is 01.01.1970
 
Top