[OGo-Developer] OWFormElementName

Helge Hess developer@opengroupware.org
Thu, 2 Nov 2006 15:59:59 +0100


On Nov 2, 2006, at 15:42, St=E9phane Corth=E9sy wrote:
> In our opinion the cause of the problem is that the default name =20
> returned for element names is not a unique ID anymore, but uses the =20=

> element's wod given name (see code below, from WOInput.m in =20
> NGObjWeb). This should not be the case, even if it helps =20
> Javascripting.

You are absolutely correct, it shouldn't be that way and it AFAIK =20
isn't ;-)

> Am I missing something? Is there a way to force a unique ID without =20=

> changing the code below?

---snip---
NSString *OWFormElementName(WOInput *self, WOContext *_ctx) {
   NSString *name;

   if (self->name =3D=3D nil)
     return [_ctx elementID];

   if ((name =3D [self->name stringValueInComponent:[_ctx component]]) !=20=

=3D nil)
     return name;
---snap---

This 'self->name' is/should be the 'name' binding of the form, not =20
the ID of the .wod element (which is stored in 'NAME').

Eg:
MyField: WOTextField {
   name =3D "myfield";
}

self->name will be 'myfield' (WOValueAssociation), not 'MyField'.


In fact I just tried samples/HelloForm and it outputs this:
---snip---
     <form action=3D"/WOxExtTest.woa/wo/=20
0147014701454A0932/001454a093208117f44.1" method=3D"post">
       Text: <input type=3D"text" name=3D"001454a093208117f44.1.1" =20
value=3D"" /><br />
       <input type=3D"submit" name=3D"001454a093208117f44.1.3" =
value=3D"OK" />
     </form>
---snap---

for this:
---snip---
Form: WOForm {
   action =3D self;
}

TextField: WOTextField {
   value =3D item;
}

Submit: WOSubmitButton {
   value =3D "OK";
}
---snap---

Which looks just fine?


> P.-S.
> This question has been posted on macosx@opengroupware.org list a =20
> few weeks ago by Marco Scheurer, but got no response. I hope I'll =20
> have more luck here.

Yes, sorry. Was lost in my inbox.

Greets,
   Helge
--=20
Helge Hess
http://docs.opengroupware.org/Members/helge/