[TYPO3-english] formhandler and multiple ajax forms
Alexander Dorn
debao84 at googlemail.com
Wed Sep 12 15:18:57 CEST 2012
Hi,
I got a page with four different forms that are submitted via ajax.
I use following versions.
formhandler v1.4
typo3 v4.6
Three of them work fine, doing what they are supposed to do.
When I try to submit the last form (contact form based on http://examples.typo3-formhandler.com/basic-forms/contact-form/) I get a "template not found" error
although the form is rendered correctly when loading the page.
The template definitely exists since the form works without ajax submission.
Any ideas?
Thank you
Alexander
Form Typoscript
plugin.Tx_Formhandler.settings.predef.kontaktformular {
# debug = 1
# This is the title of the predefined form shown in the dropdown box in the plugin options.
name = Kontakt
# All form fields are prefixed with this values (e.g. contact[name])
formValuesPrefix = contact
langFile.1 = TEXT
langFile.1.value = {$formhandlerExamples.basic.kontaktformular.rootPath}/lang/lang.xml
# templateFile = TEXT
templateFile = {$formhandlerExamples.basic.kontaktformular.rootPath}/html/step-1.html
# The master template is a file containing the markup for specific field types or other sub templates (e.g. for emails). You can use these predefined markups in your HTML template for a specific form.
masterTemplateFile = TEXT
masterTemplateFile.value = fileadmin/templates/ext/formhandler/mastertemplate.html
# These wraps define how an error messages looks like. The message itself is set in the lang file.
singleErrorTemplate {
totalWrap = <div class="error">|</div>
singleWrap = <span class="message">|</span>
}
# This block defines the error checks performed when the user hits submit.
validators {
1.class = Validator_Default
1.config.fieldConf {
name.errorCheck.1 = required
email.errorCheck.1 = required
email.errorCheck.2 = email
message.errorCheck.1 = required
}
}
ajax {
class = AjaxHandler_JQuery
config {
ajaxSubmit = 1
submitButtonSelector = .Tx-Formhandler #contact INPUT[type=\'submit\']
loading = <span class="ajaxLoader"><img src="fileadmin/templates/img/ajax-loader.gif" /></span>
ajaxSubmitLoader = <span class="ajaxLoader"><img src="fileadmin/templates/img/ajax-loader.gif" /></span>
}
}
# Finishers are called after the form was submitted successfully (without errors).
finishers {
# Finisher_Mail sends emails to an admin and/or the user.
1.class = Finisher_Mail
1.config {
checkBinaryCrLf = message
admin {
templateFile = TEXT
templateFile.value = {$formhandlerExamples.basic.kontaktformular.rootPath}/html/email-admin.html
sender_email = info at example.com
to_email = info at example.com
subject = TEXT
subject.data = LLL:{$formhandlerExamples.basic.kontaktformular.rootPath}/lang/lang.xml:email_admin_subject
}
}
# Finisher_Redirect will redirect the user to another page after the form was submitted successfully.
5.class = Finisher_SubmittedOK
5.config {
returns = 1
}
}
}
Typoscript where the form is inserted
temp.footerContact = COA
temp.footerContact {
...
20 < plugin.tx_formhandler_pi1
20.settings < plugin.Tx_Formhandler.settings.predef.kontaktformular
...
}
lib.footer = COA
lib.footer {
10 < temp.rightFooterCol
20 < temp.footerContact
30 < temp.footerRight
}
More information about the TYPO3-english
mailing list