Em Fri, 31 Jul 2009 12:04:32 -0300, Vjeran Marcinko <vjeran.marci...@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?

--
Thiago H. de Paula Figueiredo
Independent Java consultant, developer, and instructor
http://www.arsmachina.com.br/thiago

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

Reply via email to