You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Vinicius Carvalho <ja...@gmail.com> on 2006/02/06 14:02:51 UTC

Listener question

Hello there! AFAIK (I might be wrong) a form event listener is called twice
after a submit is pressed right? One for rewinding phase, and the other is
the "normal?" phase. Well, I have a form where my method is being called
twice, but both on the rewind phase, I put a simple cycle.isRewinding() if
statement on it and it always pass there.

My problem is that I do some DB checking on this in order to validate some
input fields, I was expecting that by doing:

if(!cycle.isRewinding()){
   checkConstraints();
}

Would work, but it's never called, instead the rewind phase happens twice.
I've searched the archives for this (I've seen this before) but could not
find.
Any ideas for this?

Regards

Problem with Form in IE6?

Posted by Siddhartha Argollo <sl...@tre-ba.gov.br>.
Hi there!

Is anyone else having this problem with form submissions in IE6?
When I try to submit a form in IE 6, I keep returning to the home-page 
and the listener method is not executing. The same page works fine in 
firefox.
To be sure that I wasn’t making mistakes, I copy-and-pasted the example 
found at the quick start of the tapestry page.
I’m using tapestry 4.0, but this was happing with the beta versions too.
I really don’t know if this is a bug or just my lacking of experience in 
tapestry.

Thanks for any help.

Siddhartha Argollo
slargollo@tre-ba.gov.br


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


Re: Listener question

Posted by Vinicius Carvalho <ja...@gmail.com>.
Ron, the output... Here's a snippet:

public IPage onSubmit(IRequestCycle cycle) {
        if (getDelegate().getHasErrors())
            return null;
        if (cycle.isRewinding()) {
            System.out.println("rewinding");
        } else {
            System.out.println("normal");
        }
        checkPassword();
        checkLogin();
        getUserService().register(getUser());
        return getResultPage();

    }

The "rewind" output is shown twice.

Regards

On 2/6/06, Ron Piterman <rp...@gmx.net> wrote:
>
> what makes you think it does?
>
> Vinicius Carvalho wrote:
> > Hum, but what could be causing the rewind to happens twice?
> >
> > On 2/6/06, Ron Piterman <rp...@gmx.net> wrote:
> >
> >>you are wrong :)
> >>the listener is called only once.
> >>
> >>you should use the rewind cycle to validate user input.
> >>the (normal) render cycle should always "work" to the current state of
> >>your page/application -
> >>
> >>what should checkConstraints() do ? check if something is wrong? doing
> >>it on rewind is the right time...
> >>
> >>Cheers,
> >>Ron
> >>
> >>
> >>Vinicius Carvalho wrote:
> >>
> >>>Hello there! AFAIK (I might be wrong) a form event listener is called
> >>
> >>twice
> >>
> >>>after a submit is pressed right? One for rewinding phase, and the other
> >>
> >>is
> >>
> >>>the "normal?" phase. Well, I have a form where my method is being
> called
> >>>twice, but both on the rewind phase, I put a simple cycle.isRewinding()
> >>
> >>if
> >>
> >>>statement on it and it always pass there.
> >>>
> >>>My problem is that I do some DB checking on this in order to validate
> >>
> >>some
> >>
> >>>input fields, I was expecting that by doing:
> >>>
> >>>if(!cycle.isRewinding()){
> >>>   checkConstraints();
> >>>}
> >>>
> >>>Would work, but it's never called, instead the rewind phase happens
> >>
> >>twice.
> >>
> >>>I've searched the archives for this (I've seen this before) but could
> >>
> >>not
> >>
> >>>find.
> >>>Any ideas for this?
> >>>
> >>>Regards
> >>>
> >>
> >>
> >>---------------------------------------------------------------------
> >>To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> >>For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> >>
> >>
> >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>

Re: Listener question

Posted by Ron Piterman <rp...@gmx.net>.
what makes you think it does?

Vinicius Carvalho wrote:
> Hum, but what could be causing the rewind to happens twice?
> 
> On 2/6/06, Ron Piterman <rp...@gmx.net> wrote:
> 
>>you are wrong :)
>>the listener is called only once.
>>
>>you should use the rewind cycle to validate user input.
>>the (normal) render cycle should always "work" to the current state of
>>your page/application -
>>
>>what should checkConstraints() do ? check if something is wrong? doing
>>it on rewind is the right time...
>>
>>Cheers,
>>Ron
>>
>>
>>Vinicius Carvalho wrote:
>>
>>>Hello there! AFAIK (I might be wrong) a form event listener is called
>>
>>twice
>>
>>>after a submit is pressed right? One for rewinding phase, and the other
>>
>>is
>>
>>>the "normal?" phase. Well, I have a form where my method is being called
>>>twice, but both on the rewind phase, I put a simple cycle.isRewinding()
>>
>>if
>>
>>>statement on it and it always pass there.
>>>
>>>My problem is that I do some DB checking on this in order to validate
>>
>>some
>>
>>>input fields, I was expecting that by doing:
>>>
>>>if(!cycle.isRewinding()){
>>>   checkConstraints();
>>>}
>>>
>>>Would work, but it's never called, instead the rewind phase happens
>>
>>twice.
>>
>>>I've searched the archives for this (I've seen this before) but could
>>
>>not
>>
>>>find.
>>>Any ideas for this?
>>>
>>>Regards
>>>
>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>>For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>>
>>
> 
> 


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


Re: Listener question

Posted by Ron Piterman <rp...@gmx.net>.
for example: you use the same listener on your submit and on your form...

Vinicius Carvalho wrote:
> Hum, but what could be causing the rewind to happens twice?
> 
> On 2/6/06, Ron Piterman <rp...@gmx.net> wrote:
> 
>>you are wrong :)
>>the listener is called only once.
>>
>>you should use the rewind cycle to validate user input.
>>the (normal) render cycle should always "work" to the current state of
>>your page/application -
>>
>>what should checkConstraints() do ? check if something is wrong? doing
>>it on rewind is the right time...
>>
>>Cheers,
>>Ron
>>
>>
>>Vinicius Carvalho wrote:
>>
>>>Hello there! AFAIK (I might be wrong) a form event listener is called
>>
>>twice
>>
>>>after a submit is pressed right? One for rewinding phase, and the other
>>
>>is
>>
>>>the "normal?" phase. Well, I have a form where my method is being called
>>>twice, but both on the rewind phase, I put a simple cycle.isRewinding()
>>
>>if
>>
>>>statement on it and it always pass there.
>>>
>>>My problem is that I do some DB checking on this in order to validate
>>
>>some
>>
>>>input fields, I was expecting that by doing:
>>>
>>>if(!cycle.isRewinding()){
>>>   checkConstraints();
>>>}
>>>
>>>Would work, but it's never called, instead the rewind phase happens
>>
>>twice.
>>
>>>I've searched the archives for this (I've seen this before) but could
>>
>>not
>>
>>>find.
>>>Any ideas for this?
>>>
>>>Regards
>>>
>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>>For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>>
>>
> 
> 


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


Re: Listener question

Posted by Vinicius Carvalho <ja...@gmail.com>.
Hum, but what could be causing the rewind to happens twice?

On 2/6/06, Ron Piterman <rp...@gmx.net> wrote:
>
> you are wrong :)
> the listener is called only once.
>
> you should use the rewind cycle to validate user input.
> the (normal) render cycle should always "work" to the current state of
> your page/application -
>
> what should checkConstraints() do ? check if something is wrong? doing
> it on rewind is the right time...
>
> Cheers,
> Ron
>
>
> Vinicius Carvalho wrote:
> > Hello there! AFAIK (I might be wrong) a form event listener is called
> twice
> > after a submit is pressed right? One for rewinding phase, and the other
> is
> > the "normal?" phase. Well, I have a form where my method is being called
> > twice, but both on the rewind phase, I put a simple cycle.isRewinding()
> if
> > statement on it and it always pass there.
> >
> > My problem is that I do some DB checking on this in order to validate
> some
> > input fields, I was expecting that by doing:
> >
> > if(!cycle.isRewinding()){
> >    checkConstraints();
> > }
> >
> > Would work, but it's never called, instead the rewind phase happens
> twice.
> > I've searched the archives for this (I've seen this before) but could
> not
> > find.
> > Any ideas for this?
> >
> > Regards
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>

Re: Listener question

Posted by Ron Piterman <rp...@gmx.net>.
you are wrong :)
the listener is called only once.

you should use the rewind cycle to validate user input.
the (normal) render cycle should always "work" to the current state of 
your page/application -

what should checkConstraints() do ? check if something is wrong? doing 
it on rewind is the right time...

Cheers,
Ron


Vinicius Carvalho wrote:
> Hello there! AFAIK (I might be wrong) a form event listener is called twice
> after a submit is pressed right? One for rewinding phase, and the other is
> the "normal?" phase. Well, I have a form where my method is being called
> twice, but both on the rewind phase, I put a simple cycle.isRewinding() if
> statement on it and it always pass there.
> 
> My problem is that I do some DB checking on this in order to validate some
> input fields, I was expecting that by doing:
> 
> if(!cycle.isRewinding()){
>    checkConstraints();
> }
> 
> Would work, but it's never called, instead the rewind phase happens twice.
> I've searched the archives for this (I've seen this before) but could not
> find.
> Any ideas for this?
> 
> Regards
> 


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