You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by Jeremy <jk...@jkassis.com> on 2005/10/13 05:31:44 UTC

Comments? tacos:AjaxForm Rewrite Plans

I have an AjaxForm that presents a single text field and no submit button.
When I type into the text box and hit *return* to submit, the browser
submits through the standard DirectService, not the AjaxDirectService.
That's because the action attribute of the <form> element has a url for the
DirectService, not the AjaxDirectService.

 

To fix this, the tacos AjaxForm needs to override the Form.getLink() method
and return an AjaxDirectLink. Was working on a patch 2 this. But the
Form.getLink() method is private, so I can't override. Tracing backward, I'd
have to override the Form.renderComponent method, which prolly means I'll
have to just reimplement the whole class without extending the Form object.
Seems like a lot of the Tapestry code is very difficult to extend. Some say
this is good design practice, but seems like kindof a pain to me.

 

Anyway, would be willing to give this a shot since I need this
functionality. But would like this to go into the release.

 

If I do, I'd like to eliminate the AjaxForm.isDirect parameter and add an
AjaxForm.isAjax parameter which defaults to true. If isAjax is true, then
the form uses the service injected into its ajaxService property. If false,
it uses the service injected into its altService. These would be the
AjaxDirectService and the DirectService, by default.

 

That way, I could produce a nifty Form that does this:

 

presents one field

processes the submit of the one field through ajax and then presents a
second field

processes the submit of the two fields through ajax and then presents yet
another field with the form configured to submit through the direct service

processes the submit of all three fields through the DirectService and
whisks me away to another page.

 

To be clear, the form would not support the action service. HLS has wanted
to take this out for a while anyway.

 

Comments?