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.

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.

Sylvain

--
Sylvain Wallez                        Anyware Technologies
http://apache.org/~sylvain            http://anyware-tech.com
Apache Software Foundation Member     Research & Technology Director

Reply via email to