cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Reinhard Poetz <reinh...@apache.org>
Subject Re: [cforms] Uniqueness of IDs and ValidationAware forms
Date Mon, 06 Jun 2005 08:09:37 GMT
Sylvain Wallez wrote:
> Reinhard Poetz wrote:
> 
>> Sylvain Wallez wrote:
> 
> 
> 
> <snip/>
> 
>>> The main principle of the Ajax stuff is that each part of the page 
>>> that can be updated asynchronously (not necessarily a widget) must be 
>>> fully contained in a tag (span, div, input, whatever) with a unique 
>>> id. In the case of widgets, this id is the value of 
>>> widget.getRequestParameterName().
>>
>>
>>
>> ok, sounds easy
> 
> 
> 
> :-)
> 
>>> We therefore need a distinct id for validation errors, which can be 
>>> e.g. {widget.requestParameterName}.$error, which uses the same 
>>> $-prefix convention as Java bytecode for synthetic names (those 
>>> generated by the program).
>>
>>
>>
>> this means I have to register the errors in the form object in a 
>> similar way as it is done with widgets (addWidgetUpdate() and 
>> getUpdatedWidgets()) and enhance the generateValidationError() and 
>> flushRoot(ValidationError error) methods so that they send the bu: 
>> tags with the replacement information. Right?
> 
> 
> 
> Exactly.

ok, I put it on my Cocoon todo list (if somebody needs support for this in the 
near future, don't wait for me)

> 
>>> Update of the validation error is then linked to a change of its 
>>> associated widget. For now, change detection is a boolean thing 
>>> (changed / unchanged) but we may go to something more fine-grained in 
>>> the future (e.g. value changed / error changed / selection list 
>>> changed etc).
>>
>>
>>
>> your explanations have made me think of the uniqueness of names. As 
>> long as you only have forms of a different type on the page the names 
>> are unique, at least if you set the id attribute in the form tag of 
>> the form definition.
>>
>> But if you use the same form definition more than once, you'll run 
>> into problems. These become obvious if you run the same form in two 
>> different portlets. If the form uses a field of type "date" the date 
>> chooser is confused because there are two fields with the same id. 
>> IIUC this must be a problem for Ajax too. Right?
> 
> 
> 
> Yes. Note that a form can have an id, although it is generally left 
> empty. This form id can be used to ensure global uniqueness in a 
> composite page. But this id must come from the outside environment of 
> the form, to allow e.g. the same form to be used several times in a page.
> 
> Hmm... we need a unique id generator that produces short and valid ids.

Maybe generating paramter names like registrationForm@234234.email helps. WDYT?


-- 
Reinhard Pötz           Independent Consultant, Trainer & (IT)-Coach 

{Software Engineering, Open Source, Web Applications, Apache Cocoon}

                                        web(log): http://www.poetz.cc
--------------------------------------------------------------------

	

	
		
___________________________________________________________ 
Gesendet von Yahoo! Mail - Jetzt mit 1GB Speicher kostenlos - Hier anmelden: http://mail.yahoo.de

Mime
View raw message