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.

Wichtig Angaben für fast jede Frage:
V1: Welche Visforms-Version läuft?
V2: Welche Joomla-Version läuft?
V3: Welche PHP-Version läuft?

How to allow only one checkbox checked of a checkboxgroup?

Mehr
6 Jahre 7 Monate her - 6 Jahre 7 Monate her #5459 von jjs
Hello Aicha,

how do i allow only one checkbox to be checked by visitor?
The checkboxes are both (yes and No) unchecked.

When i use the minimum and maximum value and set it to 1, it does not seem to work. At least i expect if one checkbox is checked and then for example the other one is checked, the first one should be automatically be unchecked. (similair like Radio Buttons behaviour, but none may be pre checked while entering the form the first time.)

What do i need to set here to have it work correctly? Or is it a bug?

Thanks very much.
Jerry
Letzte Änderung: 6 Jahre 7 Monate her von jjs.

Mehr
6 Jahre 7 Monate her #5461 von Administrator AV
Hi Jerry,

maybe this documentation article can help you to understand better how the validation works.
www.vi-solutions.de/en/documentations/vi...validate-user-inputs

If you want to enforce, that a user must make an input (or in your case, check a checbox) you have to make the field required. If the field is not required an empty value (nothing checked) is a valid user input.

The min/max length validation only kicks in, when the user makes an input. So if you set the minimum value and the maximum value to yes, Visforms will validate that only one checkbox is checked. If more than one checkbox is checked, it will prevent the user from submitting the form and will display an error message after the user has hit the "Submit" button.

Checkbox-groups do not behave like radio buttons, because it is an intirinsic behavior of radio buttons, that only one option can be selected, and this is not an intrinsic behavior of a checkbox group. It is the browser, that automatically unchecks a radio button, if anonther otpion es selected, not Visforms and this behavior is not implemented for checkbox groups (in the browser).

So I think, there is no bug in Visforms. Set the required to yes, set minimum and maximum lenght to 1 and the form can only be submitted, if the user has check exactly one checkbox of the group. If they check none or more than one, an error message will be displayed on submit and they have to correct the input manullly.

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
6 Jahre 7 Monate her #5462 von jjs
Hello Aicha,

great! thanks.
I had it required, but somehow i did not see it work correctly.
But indeed it does work, when both checkboxes are checked, a notification is popping up that only one can be checked.
Thanks a lot!

Moderatoren: Administrator AVAdministrator IV
Powered by Kunena Forum