[OGo-MacOSX] OWFormElementName

Marco Scheurer macosx@opengroupware.org
Wed, 11 Oct 2006 18:58:30 +0200


Hi all,

While trying to update an old (> 2 years) SOPE application to SOPE  
4.5 I encountered a problem where form elements would be confused  
with one another. This happens for instance if we reuse a component  
in several place on a page, a common occurence.

In our opinion the cause of the problem is that the default name  
returned for element names is not a unique ID anymore, but uses the  
element's wod given name (see code below, from WOInput.m in  
NGObjWeb). This should not be the case, even if it helps Javascripting.

Am I missing something? Is there a way to force a unique ID without  
changing the code below?

Thanks in advance,

marco



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

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

   if ((name = [self->name stringValueInComponent:[_ctx component]]) ! 
= nil)
     return name;

   [[_ctx component]
          logWithFormat:
                @"WARNING: in element %@, 'name' attribute configured  
(%@),"
                @"but no name assigned (using elementID as name) !",
                self, self->name];
   return [_ctx elementID];
}