[OGo-Developer] OWFormElementName
Helge Hess
developer@opengroupware.org
Tue, 12 Dec 2006 20:43:21 +0100
On Dec 12, 2006, at 18:42, St=E9phane Corth=E9sy wrote:
> I dug that problem deeper.
> The error, committed in v1101, is in WOWrapperTemplateBuilder.m. In =20=
> -dynamicElementWithName:attributes:contentElements:, there is a =20
> call [self addAttributes:_attributes toAssociations:assoc]. =20
> _attributes contains the element's 'name' (or 'NAME') that is in =20
> the <WEBOBJECT NAME=3D...> element,
Yes.
> and that name is added to the associations, whereas it shouldn't.
No, it isn't, at least I can't see where and I can't reproduce your =20
issue either.
---snip---
if (count =3D=3D 1 && [_attrs objectForKey:@"NAME"] !=3D nil)
return;
e =3D [_attrs keyEnumerator];
while ((key =3D [e nextObject]) !=3D nil) {
BOOL doRelease;
id value;
if ([key isEqualToString:@"NAME"]) /* <WEBOBJECT NAME=3D"">, not =20=
in assocs */
continue;
---snap---
The 'NAME' is explicitly skipped.
> By commenting that line out, problem is solved. If there could be =20
> more key-value pairs than the 'name' one (why/how? Not in a .wo =20
> template
In SOPE you can override associations inside the template or even =20
have an element without a .wod entry, eg:
<#WOString var:value=3D"customer.name" />
or
<#MyString value=3D"Title 1"/>
<#MyString value=3D"Title 2"/>
<WEBOBJECT NAME=3D"MyString" value=3D"Title 3"></WEBOBJECT>
with
MyString: WORichString {
bold =3D YES;
}
etc.
> , AFAIK, but probably in .wox ones)
No, the .wox parser never populates the attrs, it directly builds =20
associations from the tag attributes.
> , then we should simply remove those (name/NAME) ones from the =20
> dictionary passed to addAttributes:toAssociations:.
Or skip them ;-)
> Though it is annoying to have to add an explicit 'name' attribute =20
> to WOElements when you need to refer to that element in javascript, =20=
> for example, it is definitely not possible to use the
> <WEBOBJECT NAME=3D...> value; you will have invalid HTML as soon as =20=
> your <WEBOBJECT NAME=3D...> is used more than once in your page, for =20=
> example wrapped in a WORepetition, or coming from another component.
I absolutely agree. The 'WEBOBJECT NAME' shouldn't and has nothing to =20=
do with the output.
Sorry, but as mentioned I can't reproduce your issue and in the code =20
it looks quite right?! :-(
Greets,
Helge
--=20
Helge Hess
http://docs.opengroupware.org/Members/helge/