cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jason Johnston <>
Subject Re: CForms: some renamings on the Widget interface
Date Mon, 13 Jun 2005 20:03:56 GMT
On Mon, 2005-06-13 at 17:02 +0200, Sylvain Wallez wrote:
> Hi all,
> As part of the stabilization work on CForms, there are a couple of 
> changes I'd like to do on the naming-related methods of the Widget 
> interface.
> Today we have:
> - getId() which returns the local name of widget.
> - getRequestParameterName() which returns the combination of the parent 
> widgdet's requestParameterName with the local name.
> Working with advanced templates and Ajax stuff, I find these names 
> increasingly annoying and confusing:
> - each widget produces an HTML element with an "id" attribute filled 
> with getRequestParameterName(), and not getId()!

The HTML element is also given a "name" attribute with the same value,
which is what is actually used as the parameter name when the form is
submitted.  As far as the HTML form is concerned (don't know about your
Ajax work) the id attribute on the HTML element is meaningless.

> - this getRequestParameterName is really tooooo long to type, especially 
> in templates where we have no IDE autocompletion.
> Ideally, I'd like to do the following renaming:
> - getId() --> getName()
> - getRequestParameterName() --> getId()
> But since the meaning of getId() changes, this is likely to cause weird 
> things in existing code.
> So I propose the following:
> - getId() --> getName()

So now the method name no longer matches the form definition:

<fd:field id="theIdOfTheWidget">

So now we use getName() to get the value of the id attribute?  This
seems to me like you're causing a greater asymmetry in an attempt to
solve a lesser one.

> - getRequestParameterName() --> getFullId()

Since it seems you're wanting to tie this method more closely to the
widget's HTML styling, what about just getName()?  That would match the
HTML element's 'name' attribute which is what gets sent in the request

> - deprecate and remove later getId() and getRequestParameterName().

> Once getId() will have been removed for some time, we'll be able to 
> reintroduce it as an equivalent to getFullId().
> Sylvain

View raw message