Not empty validation for GPS coordinates



I have the following not empty validation applied for several elements that should check if another field element is not empty.
return (string)'{contracts_tool_servicii_765_repeat___adresa_anexa_vpn_nou_raw}' !='';

Works fine for any value (text, number etc) except GPS coordinates like 44° 25' 36.363" N 26° 6' 9.138" E.

After Submit I get this error:

0 syntax error, unexpected '36.363' (T_DNUMBER), expecting ';'
C:\webserver\Apache24\htdocs\dev\components\com_fabrik\models\validation_rule.php(149) : eval()'d code:1

I tried to addslashes to the string but it doesn't work, same error.
$adresa = (string)'{contracts_tool_servicii_765_repeat___adresa_anexa_vpn_nou_raw}';
return filter_var($adresa, FILTER_SANITIZE_ADD_SLASHES) !='';

What can I do to run this validation?

Thank you
Where are you doing this?
Try to use a Fabrik element variable, not the placeholder (I assume you'll get such an error always with strings containing ' and ").

So something like
JFactory::getApplication()->input->get('contracts_tool_servicii_765_repeat___adresa_anexa_vpn_nou_raw'); //resp. the new J!4 syntax
or one of these
We are in need of some funding.
More details.

Thank you.

Members online

No members online now.