Joomla 5 Mitteilung

Wir freuen uns mitteilen zu können, dass seit dem 29. Januar 2024 alle unsere Joomla Erweiterungen mit Joomla 5 kompatible sind.

Für alle die gerade noch von Joomla 3 auf 4 aktualisieren: Anleitungen für die Joomla 4 Migration gibt es hier:

Es gibt nun auch eine eigenständige Dokumentation für Visforms für Joomla 4 und für Visforms auf Joomla 5

Forum

Visforms Subscription Inhaber können in unserem Forum Fragen stellen. Bitte mit dem entsprechenden Benutzer anmelden.
Jeder kann lesend auf das Forum zugreifen.

Bitte stellen Sie nur 1 Frage pro Thema.

Weird separator causes problems in Joomla

Mehr
4 Jahre 9 Monate her #6264 von webdev-ae
Weird separator causes problems in Joomla wurde erstellt von webdev-ae
I have a form with a checkbox group.
Here is what I see in the database:
select F69 , F70 , F71 , F72 from cms_visforms_6;
Code:
+--------------------------+------------+------------+--------------+ | F69 | F70 | F71 | F72 | +--------------------------+------------+------------+--------------+ | yves.geunes@aeronomie.be | 2017-07-24 | 2019-07-31 | 11 , 21 , 12 | +--------------------------+------------+------------+--------------+

I tried to access the data using the joomla API:
Code:
$query="select F69 as mail, F70 as startdate, F71 as enddate, F72 as days from cms_visforms_6 where F69='$mail'"; $db->setQuery($query); $result = $db->loadAssocList(); error_log(print_r($result,true)); file_put_contents("PARTTIME.TXT",print_r($result,true),FILE_APPEND);
The error_log showed:
Code:
[0] => Array\n (\n [mail] => yves.geunes@aeronomie.be\n [startdate] => 2017-07-24\n [endd ate] => 2019-07-31\n [days] => 11
The file pARTTIME.TXT showed me:
Code:
[0] => Array ( [mail] => yves.geunes@aeronomie.be [startdate] => 2017-07-24 [enddate] => 2019-07-31 [days] => 11 )
When I use mysql CLI I see:
Code:
+--------------------------+------------+------------+--------------+ | mail | startdate | enddate | days | +--------------------------+------------+------------+--------------+ | yves.geunes@aeronomie.be | 2017-07-24 | 2019-07-31 | 11 , 21 , 12 | +--------------------------+------------+------------+--------------+
Only when I redirected the output of the mysql command to a file, I found out the truth:
Code:
mail startdate enddate days yves.geunes@aeronomie.be 2017-07-24 2019-07-31 11\0, 21\0, 12

I understand that a \0 character is used as separator, but it is not very clear, and Joomla stumbled on it. To obtain my data, the query had to be modified to:
Code:
$query="select F69 as mail, F70 as startdate, F71 as enddate, replace(F72,'\0','') as days from cms_visforms_6 where F69='$mail'";

Mehr
4 Jahre 9 Monate her #6265 von Administrator AV
Administrator AV antwortete auf Weird separator causes problems in Joomla
Hi,
thanks for your post!

Actually this is not a weird separator but the null byte.

As visForms supports multi select in checkbox groups and in selects and any selected options must be stored in the database and the option value, which is actually stored might contain almost any character. Using the null byte in order to separate the stored otpion values is very common way to handle such problems.

So this is the intended behavior and visForms does handle the null byte properly in its own code. But if you access the database not throughout the visForms code you have to handle it by yourself.

Thanks for sharing this information, which might be helpful for other users who want to access the visForms tables directly.

Regards,
Aicha

:idea: I recommend you the new and up-to-date documentation for Joomla 4:
docs.joomla-5.visforms.vi-solutions.de/en/docs/
Most of this also applies retrospectively to Joomla 3.
Please only ask 1 question per topic :-).

:idea: Ich empfehle Dir die neue und aktuelle Dokumentation für Joomla 4:
docs.joomla-5.visforms.vi-solutions.de/docs/
Das meiste gilt rückwirkend auch für Joomla 3.
Bitte immer nur 1 Frage pro Thema stellen :-).

Moderatoren: Administrator AVAdministrator IV
Powered by Kunena Forum