You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Vjeran Marcinko <vj...@email.t-com.hr> on 2009/08/01 07:20:02 UTC

Re: How to fetch Form from within "afterSubmit" handler?

I took a look at Select component and found the way to record error from 
within "afterSubmit" handler. I don't have to fetch Form component (though 
it's the way shown in documentation), but I can also inject 
ValidationTracker via Environmental and record error there.

BTW, thanx for the tips but I would always first look if some functionality 
can be achieved via "normal template" component before reaching for hard 
core rendering inside code (render methods) because I think that average 
Tapestry user would find this too advanced.

-Vjeran

----- Original Message ----- 
From: "Thiago H. de Paula Figueiredo" <th...@gmail.com>
To: "Tapestry users" <us...@tapestry.apache.org>
Sent: Friday, July 31, 2009 5:34 PM
Subject: Re: How to fetch Form from within "afterSubmit" handler?


> Em Fri, 31 Jul 2009 12:04:32 -0300, Vjeran Marcinko
> <vj...@email.t-com.hr> escreveu:
>
>> Actually you mentioned something that interested me before and is
>> generalization of the problem I described below.
>
> :)
>
>> There are frequent cases when I want to create some "edit" component for
>> some domain class which on the web page requires more than one HTML form
>> field. I noticed this AbstractField class, but I always thought it is
>> only suitable for components that render *only one* HTML form field as
>> output, and not some multiple HTML form elements.
>
> It's only a matter of how you generate the inputs. ;)
>
> I have not tested, but that's what I'd do:
>
> Take a look at AbstractField.processSubmission(String elementName): you
> can generate a div containing the month and year fields.
> Give getControlName() + "-month" to the name attribute of the month input
> tag. Give getClientId() + "-month" to the id attribute of the month input
> tag.
> Give getControlName() + "-year" to the name attribute of the year input
> tag. Give getClientId() + "-year" to the id attribute of the year input
> tag.
>
> protected void processSubmission(String elementName) {
>
> String monthAsString = request.getParameter(elementName + "-month");
> String yearAsString = request.getParameter(elementName + "-year");
> ...
>
> }
>
> Got the idea?
>


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