Th mailformplus
From TYPO3Wiki
This is just a short snippet allowing to verify a user input via regular expressions in the extension MailformPlus (th_mailformplus) (contact: typoheads).
You have to add the following code in typo3conf/ext/th_mailformplus/pi1/class.tx_thmailformplus_pi1.php <PHP> :function check_form($content,$conf) { [...] foreach ($this->get_post as $key => $value) { if (isset($conf["check."][$key])) { if (!preg_match( "/".str_replace("/","\/",$conf["check."][$key])."/", $value)) { $temp = $GLOBALS["TSFE"]->cObj->getSubpart( $this->templateCode_error, 'ERROR_'.$key); if ($temp) { $error .= $temp; $this->errors['###error_'.$key.'###'] = $temp; } else { $error .= "<li>".ucfirst($key); } } } } [...] ############################ # file uploads! # if a file upload directory is specified in TypoScript # filename: [pageID]_[newRecordID].[filetype] ############################If you have done this, you can now define a regular expression in your template in the setup section. For example the following code will verify the form field "email" and test whether it is a correct email address: <TS> :
plugin.tx_thmailformplus_pi1.check.email = ^([0-9a-zA-Z]([-.\w]*[0-9a-zA-Z])*@(([0-9a-zA-Z]) ([-\w]*[0-9a-zA-Z])*\.) [a-zA-Z]{2,9})$
This information is from http://wissen.hgplaza.de/66.html
[edit]
Prefilled fields
<TS> :# Example: insert E-Mail-Adress of feuser # with parameter &userid=#number# # you can insert the email-Adress into the # field "email" plugin.tx_thmailformplus_pi1.fieldConf { email { # which user should be selected defaultValue.dataWrap = {GPvar:userid}| # take the email of the selected user defaultValue.wrap3 = {DB:fe_users:|:email} defaultValue.insertData = 1 } }
[edit]
Using Marker
plugin.tx_thmailformplus_pi1 {
# using single marker via ###required### in Template
markers.required = TEXT
markers.required.value = *
markers.required.noTrimWrap = | | |
# using SUBPART via ###FORM### in Template with additional Template:
###TEMPLATE_FORM###
Hello World - this snippet will be included
###TEMPLATE_FORM###
markers.FORM = SUBPART
markers.FORM.value = ###TEMPLATE_FORM###
}
maholtz 13:10, 4 April 2008 (CEST)
