Adding the following HTML to a useknown=true form:
<input type="radio" name="services" value="web">
<input type="radio" name="services" value="mobile">
Causes a duplicate ID error.
Changing the name attribute to an empty array also
causes the error:
<input type="radio" name="services[]" value="web">
<input type="radio" name="services[]" value="mobile">
Filling in the array with keys doesn't cause a compiler
error:
<input type="radio" name="services[0]" value="web">
<input type="radio" name="services[1]" value="mobile">
But this causes the browser to treat each radio as a
separate field element, and checks both by default.
I also noted that the incorrect syntax, with an id AND
a name:
<input id="services" name="web" value="web" type="radio">
Doesn't cause any errors.
I don't know how the ComponentReporter works in much
detail, but I got it working with a quick hack:
function checkServerId(&$Component) {
$Tree = & GetComponentTree();
$ServerId = $Component->getServerId();
if (in_array($ServerId,$Tree->tagIds)
&& $Component->attributeNodes['type']->value !=
'radio') {
RaiseError('compiler', 'DUPLICATEID', array(
'ServerId' => $ServerId,
'tag' => $Component->tag,
'file' => $Component->SourceFile,
'line' => $Component->StartingLineNo));
} else {
$Tree->tagIds[]=$ServerId;
}
}
This might be better solved with a <form:radio> or
<form:radiolist> component, but it would be great if
all basic HTML <input> tags could work correctly under
useknown=true as well.
Thanks,
Mark
Logged In: YES
user_id=569780
Thanks for pointing that out. I guess we need something like
like the Select tags - the prepare() method in the
select.tag.php for the SelectMultiple checks for "control
arrays".
There's a whole area we've avoided so far though, where
forms are concerned and arrays. Comes up in feature request
859212. This is on the list to be implemented before the
coming release and think this bug is part of the bigger problem.
FYI - ComponentReporter right now is just a "dumb"
collection of static methods used to centralize some of the
errors that can occur in the parsing process.