See this post for something to base your own implementation on.

http://tinybits.blogspot.com/2009/05/simple-onevent-mixin.html

On Wed, Nov 25, 2009 at 7:32 PM, Everton Agner
<everton_ag...@yahoo.com.br>wrote:

> For this situation, that would be a workaround...
>
> I think I'll add ChenilleKit core dependency to the project (and later for
> the Library) and use the OnEvent mixin for properly handling Change event on
> Select components...
>
> Thanks!
>
> Everton
>
>
>
>
> ________________________________
> De: Ilya Obshadko <ilya.obsha...@gmail.com>
> Para: Tapestry users <users@tapestry.apache.org>
> Enviadas: Quarta-feira, 25 de Novembro de 2009 15:35:03
> Assunto: Re: Change Event on Select Component
>
> You need to simluate submit button click, so you could clearly separate
> form
> events.
>
> A few days before I posted complete mixin code for similar issue.
> If you cannot find it in archives, let me know - I could send the source.
>
> On Wed, Nov 25, 2009 at 8:08 PM, Everton Agner
> <everton_ag...@yahoo.com.br>wrote:
>
> > Thanks for the answers.
> >
> > I thought I could do it without forcing form submission, like I said with
> > the "onChange" manipulation in the page Class (that i think it uses
> Ajax).
> >
> > The form submission that you said works fine, but I have a problem.
> >
> > Like I said, I'm creating a component that renders this Select component
> > for Locale Changing. I'll show a bit of the code for Login page, Layout
> > component and LocaleSwitcher component so I can explain the problem after
> > it.
> >
> > - Layout component (Template)
> >
> > <html ...>
> >    ...
> >    <t:localeSwitcher />
> >    ...
> >    <t:body />
> >    ...
> > </html>
> >
> > - Login page (Template)
> >
> > <t:layout ...>
> >    <t:form t:id="loginForm">
> >        ...
> >    </t:form>
> > </t:layout>
> >
> > - Login page (Class)
> >
> > @Component
> > private Form loginForm;
> >
> > void onValidateForm(){
> >    ...
> > }
> >
> > - LocaleSwitcher component (Template)
> >
> > <t:form t:id="localeSwitcherForm" ...>
> >    <t:select t:id="locales" model="locales" value="locale"
> > onChange="this.form.submit()" />
> > </t:form>
> >
> > - LocaleSwitcher component (Class)
> >
> >
> > @Component
> > private Form localeSwitcherForm;
> >
> > void onValidateFormFromLocaleSwitcherForm(){
> >    ...
> > }
> >
> > ---
> >
> > So, when i fire the onChange() event of the Select component, the
> > localeSwitcherForm is submitted, and the
> > onValidateFormFromLocaleSwitcherForm() method is called in the component
> > Class. After that, because my Login page Class has a generic
> > onValidateForm() method, it is also fired too, and then weird things
> > happens.
> >
> > So, i always need to implement specific submission lifecycle methods for
> my
> > Forms in every new Page I create (because the Page is inside the Layout
> that
> > renders my LocaleSwitcher component).
> >
> > And if I want to package this component in a Library, this will happen
> with
> > anyone that tries to use id, and it will be confused for them.
> >
> > I hope I could explain this problem clearly...
> >
> > And again, if there is another way I could treat the "change" Event of my
> > Select Component without this form submission, this new problem would be
> > avoided...
> >
> > Thanks!
> >
> > Everton
> >
> >
> >
> > ________________________________
> > De: Bryan Lewis <jbryanle...@gmail.com>
> > Para: Tapestry users <users@tapestry.apache.org>
> > Enviadas: Quarta-feira, 25 de Novembro de 2009 13:14:47
> > Assunto: Re: Change Event on Select Component
> >
> > It's on page 225 of my paper copy.   A simple bit of javascript:
> >
> >  <t:select value="selectedLocale" ... onchange="this.form.submit()"/>
> >
> >
> >
> > On Wed, Nov 25, 2009 at 9:49 AM, Jim O'Callaghan <jc1000...@yahoo.co.uk
> > >wrote:
> >
> > > Hi,
> > >
> > > I had a requirement to do this previously and used the example provided
> > in
> > > Tapestry 5: Building Web Applications, around page 281 - the book (or
> at
> > > least excerpts) is available on the net I think if you Google - no
> point
> > in
> > > me pasting a code example, as my code is heavily customised.  Hope this
> > > helps.
> > >
> > > Regards,
> > > Jim.
> > >
> > > -----Original Message-----
> > > From: Everton Agner [mailto:everton_ag...@yahoo.com.br]
> > > Sent: 25 November 2009 13:37
> > > To: Tapestry Users
> > > Subject: Change Event on Select Component
> > >
> > >
> > > Hi,
> > >
> > > Which is the simplier way to capture the "onChange" event of a Select
> > > component and treat it in the page Class on the appropriate Event
> > Handler?
> > > My goal is to create a Component that renders a Select component to
> > locale
> > > switching.
> > >
> > > I only could do that (in another situation) using the "ZoneUpdater"
> mixin
> > > in
> > > the Select... And I found that i could do it with the "OnEvent" mixin
> of
> > > Chenille... But I can't do it without the mixins?
> > >
> > > Thanks!
> > >
> > > Everton
> > >
> > >
> > >
> > >
> >  ______________________________________________________________________
> > > ______________
> > > Veja quais são os assuntos do momento no Yahoo! +Buscados
> > > http://br.maisbuscados.yahoo.com
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> > > For additional commands, e-mail: users-h...@tapestry.apache.org
> > >
> > >
> >
> >
> >
> >
> >
>  
> ____________________________________________________________________________________
> > Veja quais são os assuntos do momento no Yahoo! +Buscados
> > http://br.maisbuscados.yahoo.com
> >
>
>
>
> --
> Ilya Obshadko
>
>
>
>
>  
> ____________________________________________________________________________________
> Veja quais são os assuntos do momento no Yahoo! +Buscados
> http://br.maisbuscados.yahoo.com
>

Reply via email to