You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Raffaele Cigni <rc...@byte-code.com> on 2004/12/06 19:53:11 UTC

Automatic Form

Hello!
I want to create a tapestry component that produces a dynamic Form from
a JavaBean. Have anyone already made it?
I have a problem with automatization of field validation because I can't
use the .page file.

Tnx
-- 
Raffaele Cigni <rc...@byte-code.com>

Re: Automatic Form

Posted by Erik Hatcher <er...@ehatchersolutions.com>.
On Dec 6, 2004, at 3:17 PM, Nick Stuart wrote:
> In your .page file you could have a couple of simple validation fields
> for each data type (string, int, etc) and you could determine the type
> that is needed while going through the bean properties. Then (guessing
> you have a for-loop or something to spit the properties out?) there is
> nothing to stop you from using those validators on multiple fields.
>
> The .page only needs to contain the validator definitions, it doesnt
> need to know the fields that those are going to be applied to.

The .page doesn't even need to contain those.  All validators and even 
the form delegate can be obtained from getters from the page class 
itself, or somewhere navigable from the page class (like global or 
visit).

	Erik


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


Re: Automatic Form

Posted by Nick Stuart <ba...@gmail.com>.
Well you could do something like the following. It wont handle very
refined validation,  but it should be able to handle simple things
like 'required', checking for actual numbers, and the like.

In your .page file you could have a couple of simple validation fields
for each data type (string, int, etc) and you could determine the type
that is needed while going through the bean properties. Then (guessing
you have a for-loop or something to spit the properties out?) there is
nothing to stop you from using those validators on multiple fields.

The .page only needs to contain the validator definitions, it doesnt
need to know the fields that those are going to be applied to.

Hope this helps.
-Nick




On Mon, 06 Dec 2004 19:53:11 +0100, Raffaele Cigni <rc...@byte-code.com> wrote:
> Hello!
> I want to create a tapestry component that produces a dynamic Form from
> a JavaBean. Have anyone already made it?
> I have a problem with automatization of field validation because I can't
> use the .page file.
> 
> Tnx
> --
> Raffaele Cigni <rc...@byte-code.com>
> 
> 
>

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