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.

Get field value in onVisformsBeforeFormSave

Mehr
5 Jahre 2 Monate her #6074 von fstadelmann
Get field value in onVisformsBeforeFormSave wurde erstellt von fstadelmann
Hi

I try to get a field value in onVisformsBeforeFormSave.

I tried with the help of the $fields argument, but without success, I only get a empty string.

Can you please give me a sample how to get a value of a form field in the onVisformsBeforeFormSave function of my custom plugin.

Thank you!
Felix

Mehr
5 Jahre 2 Monate her #6075 von Administrator AV
Administrator AV antwortete auf Get field value in onVisformsBeforeFormSave
Hi,
in order to handle all the business logic which is provided by visforms, there is not just one "value". There is a difference between the value, which is retrieved from the POST (and validated) and which is saved in the database and for example the value which is used as value, when the form is displayed.

If you are interested in the value which is stored in the database you can access them as $field->dbValue.

If you need any further help, just ask.

Kind 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 :-).

Mehr
5 Jahre 2 Monate her #6076 von fstadelmann
fstadelmann antwortete auf Get field value in onVisformsBeforeFormSave
Hi Aicha

Thank you very much for your answer!

Assuming the database field is named "test", then I get the database value by $fields->dbValue("test"). Correct?

By the way, is there a listing of all the "properties" of $fields and the other arguments?

Kind regards
Felix

Mehr
5 Jahre 2 Monate her #6077 von Administrator AV
Administrator AV antwortete auf Get field value in onVisformsBeforeFormSave
Hi,

the field has really a lot of properties and there is no list of them. I would really recommend, that you use some sort of IDE when you try to develop custom code. php storm im great for example, but it is not free. But there are free php IDE's, too. Using a IDE gives you the opportunity to set a cursor anywhere in the code and acually see, what is available there....

The event handler function receives a fields objects array. You have to loop through these array (foreach $fields as $field) . If you want to do something with a field that is named "test" then you have to check that $field->name == 'test' and then you can get the dbValue property of that field. $field->dbValue; (this is not a function but a property of the field).

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