[TYPO3-english] formhandler multistep form
Reinhard Führicht
rf at typoheads.at
Tue Oct 5 09:30:03 CEST 2010
Am 2010-10-04 23:25, schrieb Toshiyuki Toda:
> Hi list.
>
> I use extension formhandler.
> I want to make multistep form with conditions below.
>
> pattern 1: FORM1 -> FORM2 -> FORM3
> pattern 2: FORM1 -> -> FORM3 ( skip FORM2 in some condition )
>
> Can I do ? if you know, please tell me how to do.
Hi Toshiyuki,
yes, you can do this with Formhandler.
In your HTML template you can "double define" steps.
Example:
###TEMPLATE_FORM1###
Step 1 is always the same in your case.
<br />
<form action="###REL_URL###" method="post">
###HIDDEN_FIELDS###
<input type="radio" name="formhandler[pattern]" value="1"
###checked_pattern_1### />Pattern 1<br />
<input type="radio" name="formhandler[pattern]" value="2"
###checked_pattern_2### />Pattern 2<br />
<input type="submit" ###submit_nextStep### value="next" />
</form>
###TEMPLATE_FORM1###
###TEMPLATE_FORM2###
This will only be shown in "pattern 1".
<br />
<form action="###REL_URL###" method="post">
###HIDDEN_FIELDS###
<input type="submit" ###submit_prevStep### value="prev" />
<input type="submit" ###submit_nextStep### value="next" />
</form>
###TEMPLATE_FORM2###
###TEMPLATE_FORM2_B###
###TEMPLATE_FORM3###
This will be shown as step 3 in "pattern 1" and as step 2 in "pattern 2".
<br />
<form action="###REL_URL###" method="post">
###HIDDEN_FIELDS###
<input type="submit" ###submit_prevStep### value="prev" />
<input type="submit" ###submit_nextStep### value="next" />
</form>
###TEMPLATE_FORM3###
###TEMPLATE_FORM2_B###
You can configure these patterns with conditions:
plugin.Tx_Formhandler.settings.predef.conditions_example {
name = Conditions example
templateFile = fileadmin/path/to/your/template/template.html
formValuesPrefix = formhandler
# Conditions for step 1
1.if.1 {
conditions {
OR1 {
# If the user entered a special value
AND1 = pattern=2
}
}
isTrue {
2 {
# set the suffix to _B, so ###TEMPLATE_FORM[X]_B### is taken
templateSuffix = _B
# Optional: Reconfigure error checks if needed
#validators.1.config.fieldConf.phone.errorCheck.1 = required
#validators.1.config.disableErrorCheckFields = street
}
}
}
}
This is actually a working example. You can just copy paste the code,
configure the path to the template file and try it out.
Kind regards,
Reinhard
More information about the TYPO3-english
mailing list