[TYPO3-english] Formhandler and validating generic radio buttons
Michael Lykke
typo3 at lykke-it.dk
Thu May 17 16:12:33 CEST 2012
Hi list
I'm trying to use generic radio buttons in a form based on the
Formhandler extension. The situation is that I'm planning on making a
multistep form with a series of yes/no questions. For this, I would like
to use the same master template subpart containing the markup for radio
buttons. This is all working as expected.
My problem is when it comes to validating the radio buttons. No matter
if one or the other or none of the radio buttons are checked, the
validator comes out saying that the field needs to be filled out. I
think that it has something to do with calculating the value of the
checked radio button but I'm not sure. The generated markup looks fine.
Here is my master template subpart for radio buttons:
<!-- ###master_radio-yesno### -->
###error_###fieldname######
<div class="type-check">
<label for="radio-yesno-###fieldname###-yes"
###is_error_radio-yesno-###fieldname######>###LLL:radio-yesno-###fieldname######
###required_radio-yesno-###fieldname######</label>
<div>
<input type="radio" id="radio-yesno-###fieldname###-yes"
name="###formValuesPrefix###[radio-yesno-###fieldname###]"
value="###LLL:radio-yesno-###fieldname###.yes###"
###checked_radio-yesno-###fieldname###_###LLL:radio-yesno-###fieldname###.yes######
/>
<label
for="radio-yesno-###fieldname###-yes">###LLL:radio-yesno-###fieldname###.yes###</label>
</div>
<div>
<input type="radio" id="radio-yesno-###fieldname###-no"
name="###formValuesPrefix###[radio-yesno-###fieldname###]"
value="###LLL:radio-yesno-###fieldname###.no###"
###checked_radio-yesno-###fieldname###_###LLL:radio-yesno-###fieldname###.no######
/>
<label
for="radio-yesno-###fieldname###-no">###LLL:radio-yesno-###fieldname###.no###</label>
</div>
</div>
<!-- ###master_radio-yesno### -->
It looks ok, right? What else could be the problem?
I create the field in step1.html like this:
###master_radio-yesno_question1###
Which generates this markup:
<div class="type-check">
<label for="radio-yesno-question1-yes">Some question? </label>
<div>
<input type="radio" id="radio-yesno-question1-yes"
name="form-multistep[radio-yesno-question1]" value="Yes">
<label for="radio-yesno-koncert-yes">Yes</label>
</div>
<div>
<input type="radio" id="radio-yesno-question1-no"
name="form-multistep[radio-yesno-question1]" value="No">
<label for="radio-yesno-question1-no">No</label>
</div>
</div>
And validating it like this:
1.validators {
1.class = Validator_Default
1.config.fieldConf {
question1.errorCheck {
1 = required
}
}
}
Can anyone help, please?
More information about the TYPO3-english
mailing list