Project

General

Profile

Actions

Bug #20391

closed

No Underscores in Name-Attribute of FORM-Object (Typoscript)?

Added by Andre Dittmar over 15 years ago. Updated about 11 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
-
Target version:
-
Start date:
2009-05-04
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
4.2
PHP Version:
4.3
Tags:
Complexity:
Is Regression:
No
Sprint Focus:

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)

Actions

Also available in: Atom PDF