You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Howard Lewis Ship <hl...@gmail.com> on 2007/03/01 01:06:35 UTC

Re: T5 validation

@Component
private Form _form;


This defines the type of the component with an id of "form" as being
an instance of the Form component. Further, you can access the form to
record errors into it.

On 2/28/07, Terry <te...@meta-concepts.com> wrote:
>
> Following the beaneditform pattern, I have a page that submits a form with
> field validation using the included annotations. Now I would like to perform
> second stage validation on the data returned (checking for uniqueness
> against a database, etc) and to use the same error reporting mechanism to
> feed back field level errors to the user.
>
> If my page is a POJO and my form data is a POJO that is wired up by magic,
> how do I get access to the Form object from within the page to invoke
> recordError?
>
> Thanks,
>
> Terry
> --
> View this message in context: http://www.nabble.com/T5-validation-tf3323698.html#a9240017
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>


-- 
Howard M. Lewis Ship
TWD Consulting, Inc.
Independent J2EE / Open-Source Java Consultant
Creator and PMC Chair, Apache Tapestry
Creator, Apache HiveMind

Professional Tapestry training, mentoring, support
and project work.  http://howardlewisship.com

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


Re: [WARNING] T5 validation

Posted by Terry <te...@meta-concepts.com>.
>  I could make this error noticable by requiring that
> all components have an explicit id in the template

I think that the approach of making the framework smart enough to provide
useful default behaviours is always a good one. If anything is lacking at
the moment, it is just documentation to show how to apply fine-grained
manual configuration when required. A perennial problem and not something
that could be expected at this point in the development in any case.

> Ah, that could be my catchphrase for Tapestry 5 Training!

Well, it was an open source comment, so feel free to take it and refactor to
fit you application...

;)

Terry
-- 
View this message in context: http://www.nabble.com/T5-validation-tf3323698.html#a9267798
Sent from the Tapestry - User mailing list archive at Nabble.com.


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


Re: [WARNING] T5 validation

Posted by Howard Lewis Ship <hl...@gmail.com>.
With the fresh start in T5 I've been able to make it smarter and more
adaptable, or at least, do better things by default.  But there's a
lot of limits.  I could make this error noticable by requiring that
all components have an explicit id in the template, but that would
inconvienience most users for most components, where an id really
isn't needed, or Tapestry can provide a good default id.

On 3/1/07, Terry <te...@meta-concepts.com> wrote:
>
> D'oh! That's obvious now I look at it. Like most things in Tapestry, once you
> have seen it once... :)

Ah, that could be my catchphrase for Tapestry 5 Training!

>
> Thanks.
>
>
> Howard Lewis Ship wrote:
> >
> >
> > BeanEditForm is not a Form, but does own one; it includes a getForm()
> > accessor.  So:
> >
> > @Component
> > private BeanEditForm _beanEditForm;  // Case just doesn't matter to
> > Tapestry!
> >
> >
> >
>
> --
> View this message in context: http://www.nabble.com/T5-validation-tf3323698.html#a9252108
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>


-- 
Howard M. Lewis Ship
TWD Consulting, Inc.
Independent J2EE / Open-Source Java Consultant
Creator and PMC Chair, Apache Tapestry
Creator, Apache HiveMind

Professional Tapestry training, mentoring, support
and project work.  http://howardlewisship.com

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


Re: [WARNING] T5 validation

Posted by Terry <te...@meta-concepts.com>.
D'oh! That's obvious now I look at it. Like most things in Tapestry, once you
have seen it once... :)

Thanks.


Howard Lewis Ship wrote:
> 
> 
> BeanEditForm is not a Form, but does own one; it includes a getForm()
> accessor.  So:
> 
> @Component
> private BeanEditForm _beanEditForm;  // Case just doesn't matter to
> Tapestry!
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/T5-validation-tf3323698.html#a9252108
Sent from the Tapestry - User mailing list archive at Nabble.com.


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


Re: [WARNING] T5 validation

Posted by Howard Lewis Ship <hl...@gmail.com>.
You didn't supply a component id, so Tapestry did; your id is
"beaneditform" (matching the type of the component, converted to lower
case).

BeanEditForm is not a Form, but does own one; it includes a getForm()
accessor.  So:

@Component
private BeanEditForm _beanEditForm;  // Case just doesn't matter to Tapestry!

_beanEditForm.getForm().recordError(" . . . ");

On 3/1/07, Terry <te...@meta-concepts.com> wrote:
>
> That's what I thought, but when I tried it previously, I just got an
> exception:
>
> "Start does not contain an embedded component with id 'form'."
>
> If I look at the source of the page that is generated without the
> @Component, I see a form with id=form, so I don't know what is missing.
>
> My page design was lifted directly from the screencast:
>
> <html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
>     <head>
>         <title>Start Page</title>
>     </head>
>     <body>
>         <h1>Registration</h1>
>         <p>Just one little form to fill in: </p>
>         <form t:type="beaneditform" object="userform" submitLabel="Register"
> >
>                 <t:parameter name="password">
>                 <label t:type="Label" for="password"/>
>                 <input t:type="PasswordField" t:id="password" t:value="userform.password"
> size="8"/>
>                 (Between 4 and 8 characters)
>                 </t:parameter>
>                 <t:parameter name="confirmPassword">
>                 <label t:type="Label" for="confirmPassword"/>
>                 <input t:type="PasswordField" t:id="confirmPassword"
> t:value="userform.confirmPassword" size="8"/>
>                 </t:parameter>
>         </form>
>
>         <p>
>             [ refresh ]
>         </p>
>     </body>
> </html>
>
>
>
> Howard Lewis Ship wrote:
> >
> > @Component
> > private Form _form;
> >
> >
> > This defines the type of the component with an id of "form" as being
> > an instance of the Form component. Further, you can access the form to
> > record errors into it.
> >
> >
>
> --
> View this message in context: http://www.nabble.com/T5-validation-tf3323698.html#a9245715
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>


-- 
Howard M. Lewis Ship
TWD Consulting, Inc.
Independent J2EE / Open-Source Java Consultant
Creator and PMC Chair, Apache Tapestry
Creator, Apache HiveMind

Professional Tapestry training, mentoring, support
and project work.  http://howardlewisship.com

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


Re: [WARNING] T5 validation

Posted by Terry <te...@meta-concepts.com>.
That's what I thought, but when I tried it previously, I just got an
exception:

"Start does not contain an embedded component with id 'form'."

If I look at the source of the page that is generated without the
@Component, I see a form with id=form, so I don't know what is missing.

My page design was lifted directly from the screencast:

<html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
    <head>
        <title>Start Page</title>
    </head>
    <body>
        <h1>Registration</h1>
        <p>Just one little form to fill in: </p>
        <form t:type="beaneditform" object="userform" submitLabel="Register"
>
        	<t:parameter name="password">
        	<label t:type="Label" for="password"/>
		<input t:type="PasswordField" t:id="password" t:value="userform.password"
size="8"/>
		(Between 4 and 8 characters)
	        </t:parameter>
        	<t:parameter name="confirmPassword">
        	<label t:type="Label" for="confirmPassword"/>
		<input t:type="PasswordField" t:id="confirmPassword"
t:value="userform.confirmPassword" size="8"/>
		</t:parameter>
        </form>

        <p>
            [ refresh ]
        </p>
    </body>
</html>



Howard Lewis Ship wrote:
> 
> @Component
> private Form _form;
> 
> 
> This defines the type of the component with an id of "form" as being
> an instance of the Form component. Further, you can access the form to
> record errors into it.
> 
> 

-- 
View this message in context: http://www.nabble.com/T5-validation-tf3323698.html#a9245715
Sent from the Tapestry - User mailing list archive at Nabble.com.


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