Bug #20391
closedNo Underscores in Name-Attribute of FORM-Object (Typoscript)?
0%
Description
I create a form in Typoscript like
lib.myform = FORM
lib.myform {
formName = my_form
method = get
action = someformaction.php
// some more parameters
}
The result is:
<form action="someformaction.php" id="myform" name="myform" ...>
Typo3 changes "my_form" into "myform"? The same happens if I use
"my-form", camel-case like "MyForm" works well... I need that specific
name for a 3rd-Party javascript function, otherwise I would just use
any name. I'm just wondering why Typo3 changes the name? As far as I
know, are underscores permitted in name-Attributes? There is also no
advice in the TSConfig for the parameter formName, it's just expected
as a string...
tslib_content:
function FORM:
if ($conf['formName']) {
$formname = $this->cleanFormName($conf['formName']);
}
function cleanFormName($name) {
// turn data[x][y] into data:x:y:
$name = preg_replace('/\[|\]\[?/',':',trim($name));
// remove illegal chars like _
return preg_replace('#[^:a-zA-Z0-9]#','',$name);
}
Thanks for Jan Bednarik for analyze and reserach...
(issue imported from #M11030)