Validation OK if any radio button was checked

hereticxy 14 Apr, 2017
I have a 2-choice radio button (initially no choice is selected) and I want to validate it as OK only if the user selects any of the choices. "required" in the Validation tab did not work.
Max_admin 14 Apr, 2017
Answer
Hi hereticxy,

For radios or checkboxes please use this in the validations box:

minChecked[1]:Please check at least 1


For radios the number can be 1, but for checkboxes it can be higher to require more checkboxes, you can also use maxChecked[3] for a maximum number of checked items.

Best regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
FransO 10 May, 2017
Hi Max,

I tried this, but it throws an error whether I check any of the radio buttons or not. The generated html is below (with some carriage returns added for readability in the code frame).

Best regards,

Frans
<div class="field two wide grouped fields"><label>Betaalwijze</label>
<input name="betaalwijze" type="hidden" value="" data-ghost="1">
<div class="inline field error">
<div class="ui checkbox radio checked"><input name="betaalwijze" tabindex="0" class="hidden" id="betaalwijze_id0" type="radio" value="b" 
data-events='[{"group":"1","sign":"=","value":"m","action":["show"],"identifier":"#rekeninggegevens"},
{"group":"1","sign":"!=","value":"m","action":["hide"],"identifier":"#rekeninggegevens"},
{"group":"1","sign":"=","value":"m","action":["enable_validation"],"identifier":"#iban_id"},
{"group":"1","sign":"!=","value":"m","action":["disable_validation"],"identifier":"#iban_id"}]'
 data-validate="betaalwijze_id-main" data-validationrules='{"identifier":"betaalwijze_id-main","rules":[{"type":"min[1]","prompt":"Maak uw keuze"}]}'>
<label for="betaalwijze_id0">Bank</label></div>
<div class="ui basic red pointing prompt label transition visible">Maak uw keuze</div>
</div>
<div class="inline field"><div class="ui checkbox radio"><input name="betaalwijze" tabindex="0" class="hidden" id="betaalwijze_id1" type="radio" value="m" 
data-events='[{"group":"1","sign":"=","value":"m","action":["show"],"identifier":"#rekeninggegevens"},
{"group":"1","sign":"!=","value":"m","action":["hide"],"identifier":"#rekeninggegevens"},
{"group":"1","sign":"=","value":"m","action":["enable_validation"],"identifier":"#iban_id"},
{"group":"1","sign":"!=","value":"m","action":["disable_validation"],"identifier":"#iban_id"}]'>
<label for="betaalwijze_id1">Machtiging</label></div>
</div>
<div class="inline field"><div class="ui checkbox radio"><input name="betaalwijze" tabindex="0" class="hidden" id="betaalwijze_id2" type="radio" value="n" 
data-events='[{"group":"1","sign":"=","value":"m","action":["show"],"identifier":"#rekeninggegevens"},
{"group":"1","sign":"!=","value":"m","action":["hide"],"identifier":"#rekeninggegevens"},
{"group":"1","sign":"=","value":"m","action":["enable_validation"],"identifier":"#iban_id"},
{"group":"1","sign":"!=","value":"m","action":["disable_validation"],"identifier":"#iban_id"}]'>
<label for="betaalwijze_id2">Geen toezegging</label></div>
</div>
</div>
FransO 10 May, 2017
Hi Max,

The problem is already solved by updating to the latest version of Chronoforms (6.0.4).

Thanks,

Frans
This topic is locked and no more replies can be posted.