XHTML valid mailform

Categories: Development Created by ben van 't ende (netcreators)
Yesterday his tt_news extension managed to become the most popular extension and today he made some fixes to get the mailform to obey the rules of XHTML. You can't stop this guy ;-)

Rupert has done some work on the mailform. See his comments below. You'll have to overwrite two files in order for it to work. Please test it and we'll try to get it into the next release.

This also includes a "TYPO3-bug-standard" compliant diff file ;-) You can use that diff instead of overwriting the files as mentioned below.

  1. copy the file to the dir: typo3_src-3.8.0
  2. open a shell in this dir and type: patch < class.tslib_content_jsform.diff

Rupert's comment:

Overwrite class.tslib_content.php in tslib/ folder and jsfunc.validateform.js

in t3lib/ folder with the files atached to this mail.

(they work only in TYPO3 3.8.0)

with the changed files the following new options are added to the FORM object:

----

noWrapAttr (type: boolean)

this option disables the "wrap" attribute in FORM tags

Example:

noWrapAttr = 1

---

formName (type: string)

here you insert a string which will be inserted as name/id attribute in <form>

tag

Example:

formName = theForm

---

fieldPrefix (type: boolean / string

possible values:

0 = the name/id attributes of form fields will only show the name (or the md5

hashed name)

1 = fieldnames will be prepended with the formname

[string] = fieldnames will be prepended by this string

Example:

fieldPrefix = thePrefix

---

dontMd5FieldNames (type: boolean)

by default all name/id attributes of forms will be paresed through the PHP

function md5(). This can be disabled here

Example:

dontMd5FieldNames = 1

here's the configuration for the form on my testpage:

ts-setup:

config {
doctype = xhtml_11
#xhtml_cleaning = 1
}

 

tt_content.mailform.20 {
accessibility = 1
REQ = 1
noWrapAttr = 1
formName = theForm
#fieldPrefix = 0
dontMd5FieldNames = 1
# the () syntax in the wraps makes the html source a bit more readable
layout (
###LABEL### ###FIELD###
)

COMMENT.layout (
###LABEL###
)
RADIO.layout (
###LABEL###
<fieldset class="mf-radio" id="theForm_radio">###FIELD###</fieldset>

)

LABEL.layout = ###LABEL### ###FIELD###
labelWrap.wrap = |
commentWrap.wrap = |
radioWrap.wrap = |
REQ.labelWrap.wrap = |
stdWrap.wrap = <fieldset class="csc-mailform"> | </fieldset>
params.radio = class="mf-radio"
params.check = class="mf-check"
params.submit = class="mf-submit"
}

#------------------------

this is the Form code:

input | *input=input
text area | *text_area=textarea
selector | *selector=select,auto | option1, option2, option3, option4
checkbox | checkbox=check | 1
radio | *radio=radio | radio, tv, DVB
password | *password=password
upload | *attachment1=file
| hiddenfield=hidden | 123
| go=submit | 1 | formtype_mail=submit | send
| html_enabled=hidden | 1
| subject=hidden | Subject test

....and for your convenience in a txt file: