You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Jonhy Pear <jo...@gmail.com> on 2009/11/11 00:24:25 UTC

Form.recordError not preventing from calling onSubmit form

Hello,

I'm trying to get around this for some time, so I decided to ask another
newcomer question.

I have a form in a page "resgistration"

Registration.tml

<form t:type="form" t:id="registrationForm">
<t:errors/>

[Rest of the form]
</form>

in my Registration.java I have:

void onValidateForm() {

if (!this.password.equals(this.confirmPassword)) {

registrationForm.recordError("Password match error"); ///Line 1
}
 }

Object onSubmitFromRegistrationForm() {
 successPage.setRegisteredUser(user);
return successPage;

}


The problem is that on onValidateForm I record the error in line:

registrationForm.recordError("Password match error");

I checked and is the line is being executed, but the process keep going to
the onSubmitRegistrationForm() and the new page "successPage" is rendered...

If I go back to the page "registration", the errors are displayed....


Shouldn't the form be displayed again in this case with the errors?

Thank you

Re: Form.recordError not preventing from calling onSubmit form

Posted by João Pereira <jo...@gmail.com>.
That's it. Thank you.

On Tue, Nov 10, 2009 at 11:33 PM, Piero Sartini <li...@pierosartini.de>wrote:

> > I checked and is the line is being executed, but the process keep going
> to
> > the onSubmitRegistrationForm() and the new page "successPage" is
> >  rendered...
>
> onSubmit() is called whenever the form is submitted.
> What you want to use is onSuccess(), this method is only called if the
> validation was successfull.
>
> see
> -> http://tapestry.apache.org/tapestry5.1/tapestry-
> core/ref/org/apache/tapestry5/corelib/components/Form.html
>
> for more details.
>
>        Piero
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>


-- 
João Miguel Pereira
http://jpereira.eu
LinkedIn: http://www.linkedin.com/in/joaomiguelpereira

joaomiguel.pereira@gmail.com
(351) 96 275 68 58

Re: Form.recordError not preventing from calling onSubmit form

Posted by Piero Sartini <li...@pierosartini.de>.
> I checked and is the line is being executed, but the process keep going to
> the onSubmitRegistrationForm() and the new page "successPage" is
>  rendered...

onSubmit() is called whenever the form is submitted. 
What you want to use is onSuccess(), this method is only called if the 
validation was successfull.

see 
-> http://tapestry.apache.org/tapestry5.1/tapestry-
core/ref/org/apache/tapestry5/corelib/components/Form.html

for more details.

	Piero

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