On Tue, 02 Nov 2010 20:33:27 -0200, Rich M <rich...@moremagic.com> wrote:

Hi,

Hi!

so I've had to add some mixins to a form to conditionally handle some form elements based on used input. A user selects a certain select list option, some fields get disabled or enabled as a result type thing.

Does all this logic need to be implemented server-side? If yes and they invole a little amount of data, you can generate JavaScript to handle all this client-side.

Have you thought about doing a triggering an event using a little bit of JavaScript and make return a JSONObject or JSONArray in your event handler method containing the needed data?

Also, I know it's possible to pass all the form values through as request parameters via AJAX

Yes. See http://api.prototypejs.org/ajax/ajax/request/, http://api.prototypejs.org/dom/form/serialize/, http://api.prototypejs.org/dom/form/request/ and http://madchicken.altervista.org/js/deserialize.js (found here: http://madchicken.altervista.org/tech/2006/02/prototype-form-serialization-and.html). If you're using another JavaScript framework it probably offers something like that too.

and copy them into the property bindings of the form elements manually, but that seems pretty excessive.

You won't need that. Just submit the form by JavaScript and Tapestry will set the properties.

I hope that's not my best option =/.

IMHO, your scenario is quite specific, so you'll need custom JavaScript. You want to submit a form and update some fields but not others.

--
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer, and instructor
Owner, Ars Machina Tecnologia da Informação Ltda.
http://www.arsmachina.com.br

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to