You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Ben Titmarsh <be...@hotmail.co.uk> on 2013/05/28 13:48:11 UTC

jQuery/bind mixin does not submit field value onChange

Hi All,

I am using the jQuery bind mixin to respond to 'onChange' events from my form fields, process the change then update the zone.  This is my tml:

<t:select t:id="superTypeOverride" t:clientId="superTypeOverride" t:value="cubeCard.superTypeCombinationOverride" 
t:mixins="jquery/bind" 
bind.context="cubeCard.id" 
bind.event="SuperTypeOverrideChanged" 
bind.eventType="change" 
bind.zone="gridZone" t:zone="gridZone" />

I have a bunch of these created in a loop, each with a different cubeCard.id context value.

What I'm seeing is that when the value of the field is changed, two requests are produced:

1. /editcube:supertypeoverridechanged/49
2. /editcube.supertypeoverride:change

The first one contains the important context value and the second one contains the changed value of the form field in the Request body.  I can add a handler for both in my page class:

1. public Object onSuperTypeOverrideChanged(Integer cubeCardId) 
2. public void onChangeFromSuperTypeOverride() 

But the problem is that I need the context AND the submitted value, therefore what I'm having to do is basically wait for the second request to be processed and the value set on the server side before I can process the request containing the context:

public Object onSuperTypeOverrideChanged(Integer cubeCardId) {
Thread.sleep(200);
//processing
return gridZone.getBody();
}

Clearly this isn't ideal.  So, am I doing something wrong here?  Should I be getting two requests or just one? Is there anyone else who has experience with this mixin who can help me out?  

Thanks,
Ben.


 		 	   		  

Re: jQuery/bind mixin does not submit field value onChange

Posted by Boris Horvat <ho...@gmail.com>.
This was my issue https://github.com/got5/tapestry5-jquery/issues/295

cheers


On Wed, May 29, 2013 at 6:14 PM, Ben Titmarsh <be...@hotmail.co.uk>wrote:

> Thanks for your replies.
>
> Jens I will try out both of those suggestions!
>
> Boris - I'm actually using a fairly old version then - 3.2.0.  Do you have
> a link to the JIRA issue or release notes or anything so that I can review
> your bug report?
>
> Thanks,
> Ben.
>
> > From: horvat.z.boris@gmail.com
> > Date: Tue, 28 May 2013 19:25:48 +0200
> > Subject: Re: jQuery/bind mixin does not submit field value onChange
> > To: users@tapestry.apache.org
> >
> > Hi,
> >
> > I recently reported a bug whcih I think could be what you are talking
> > about. This was fixed in the new version 3.3.7-SNAPSHOT, are you using
> this?
> >
> > Cheers,
> > Boris
> >
> >
> > On Tue, May 28, 2013 at 4:31 PM, Jens Breitenstein <mailinglist@j-b-s.de
> >wrote:
> >
> > > Hi Ben!
> > >
> > > Any particular reason why you need bind for capturing the change event
> of
> > > a select?
> > > This works for me (honestly not tried in a AjaxFormLoop, so don't kill
> me):
> > >
> > >     <t:select class="input-small" t:id="**schoolFinderSearchOption"
> > > t:validate="required"
> > >                    blankOption="Always"
> value="**schoolFinderSearchOptionValue"
> > > zone="schoolFinderZone"/>
> > >
> > > as schoolFinderSearchOptionValue is defined as an Enum Property
> > >
> > >     @Property private ESchoolFinderSearchOption _**
> > > schoolFinderSearchOptionValue;
> > >
> > > therefore Tapestry calls
> > >
> > >     Object onValueChanged(final ESchoolFinderSearchOption esfso)
> > >     {
> > >         ....
> > >     }
> > >
> > >
> > > I guess due to the fact you have a zone and a jquery/bind at the same
> time
> > > you are getting two calls. In case you solely use bind you can send the
> > > current value as part of the request by adding a callback (this
> snipped is
> > > working for me in an AjayFormLoop with a checkbox, so please modify it
> > > accordingly for your "input field of type select"):
> > >
> > >     bind.event="**deleteCheckboxChanged"
> > >     bind.eventType="change"
> > >     bind.callback="function(event,**ui,url) {
> url.addContext(event.target.
> > > **checked); }"
> > >
> > > and this calls
> > >
> > >     Object onDeleteCheckboxChanged(final long formEventPk, final String
> > > state)        // you can even use:     ..., final boolean state)
> instead of
> > > string
> > >     {
> > >         ...
> > >     }
> > >
> > >
> > > Jens
> > >
> > >
> > >
> > >
> > > Am 28.05.13 13:48, schrieb Ben Titmarsh:
> > >
> > >  Hi All,
> > >>
> > >> I am using the jQuery bind mixin to respond to 'onChange' events from
> my
> > >> form fields, process the change then update the zone.  This is my tml:
> > >>
> > >> <t:select t:id="superTypeOverride" t:clientId="superTypeOverride"
> > >> t:value="cubeCard.**superTypeCombinationOverride"
> > >> t:mixins="jquery/bind"
> > >> bind.context="cubeCard.id"
> > >> bind.event="**SuperTypeOverrideChanged"
> > >> bind.eventType="change"
> > >> bind.zone="gridZone" t:zone="gridZone" />
> > >>
> > >> I have a bunch of these created in a loop, each with a different
> > >> cubeCard.id context value.
> > >>
> > >> What I'm seeing is that when the value of the field is changed, two
> > >> requests are produced:
> > >>
> > >> 1. /editcube:**supertypeoverridechanged/49
> > >> 2. /editcube.supertypeoverride:**change
> > >>
> > >> The first one contains the important context value and the second one
> > >> contains the changed value of the form field in the Request body.  I
> can
> > >> add a handler for both in my page class:
> > >>
> > >> 1. public Object onSuperTypeOverrideChanged(**Integer cubeCardId)
> > >> 2. public void onChangeFromSuperTypeOverride(**)
> > >>
> > >> But the problem is that I need the context AND the submitted value,
> > >> therefore what I'm having to do is basically wait for the second
> request to
> > >> be processed and the value set on the server side before I can
> process the
> > >> request containing the context:
> > >>
> > >> public Object onSuperTypeOverrideChanged(**Integer cubeCardId) {
> > >> Thread.sleep(200);
> > >> //processing
> > >> return gridZone.getBody();
> > >> }
> > >>
> > >> Clearly this isn't ideal.  So, am I doing something wrong here?
>  Should I
> > >> be getting two requests or just one? Is there anyone else who has
> > >> experience with this mixin who can help me out?
> > >>
> > >> Thanks,
> > >> Ben.
> > >>
> > >>
> > >>
> > >>
> > >
> > >
> > >
> > >
> ------------------------------**------------------------------**---------
> > > To unsubscribe, e-mail: users-unsubscribe@tapestry.**apache.org<
> users-unsubscribe@tapestry.apache.org>
> > > For additional commands, e-mail: users-help@tapestry.apache.org
> > >
> > >
> >
> >
> > --
> > Sincerely
> > *Boris Horvat*
>




-- 
Sincerely
*Boris Horvat*

RE: jQuery/bind mixin does not submit field value onChange

Posted by Ben Titmarsh <be...@hotmail.co.uk>.
Thanks for your replies.  

Jens I will try out both of those suggestions!

Boris - I'm actually using a fairly old version then - 3.2.0.  Do you have a link to the JIRA issue or release notes or anything so that I can review your bug report?

Thanks,
Ben.

> From: horvat.z.boris@gmail.com
> Date: Tue, 28 May 2013 19:25:48 +0200
> Subject: Re: jQuery/bind mixin does not submit field value onChange
> To: users@tapestry.apache.org
> 
> Hi,
> 
> I recently reported a bug whcih I think could be what you are talking
> about. This was fixed in the new version 3.3.7-SNAPSHOT, are you using this?
> 
> Cheers,
> Boris
> 
> 
> On Tue, May 28, 2013 at 4:31 PM, Jens Breitenstein <ma...@j-b-s.de>wrote:
> 
> > Hi Ben!
> >
> > Any particular reason why you need bind for capturing the change event of
> > a select?
> > This works for me (honestly not tried in a AjaxFormLoop, so don't kill me):
> >
> >     <t:select class="input-small" t:id="**schoolFinderSearchOption"
> > t:validate="required"
> >                    blankOption="Always" value="**schoolFinderSearchOptionValue"
> > zone="schoolFinderZone"/>
> >
> > as schoolFinderSearchOptionValue is defined as an Enum Property
> >
> >     @Property private ESchoolFinderSearchOption _**
> > schoolFinderSearchOptionValue;
> >
> > therefore Tapestry calls
> >
> >     Object onValueChanged(final ESchoolFinderSearchOption esfso)
> >     {
> >         ....
> >     }
> >
> >
> > I guess due to the fact you have a zone and a jquery/bind at the same time
> > you are getting two calls. In case you solely use bind you can send the
> > current value as part of the request by adding a callback (this snipped is
> > working for me in an AjayFormLoop with a checkbox, so please modify it
> > accordingly for your "input field of type select"):
> >
> >     bind.event="**deleteCheckboxChanged"
> >     bind.eventType="change"
> >     bind.callback="function(event,**ui,url) { url.addContext(event.target.
> > **checked); }"
> >
> > and this calls
> >
> >     Object onDeleteCheckboxChanged(final long formEventPk, final String
> > state)        // you can even use:     ..., final boolean state) instead of
> > string
> >     {
> >         ...
> >     }
> >
> >
> > Jens
> >
> >
> >
> >
> > Am 28.05.13 13:48, schrieb Ben Titmarsh:
> >
> >  Hi All,
> >>
> >> I am using the jQuery bind mixin to respond to 'onChange' events from my
> >> form fields, process the change then update the zone.  This is my tml:
> >>
> >> <t:select t:id="superTypeOverride" t:clientId="superTypeOverride"
> >> t:value="cubeCard.**superTypeCombinationOverride"
> >> t:mixins="jquery/bind"
> >> bind.context="cubeCard.id"
> >> bind.event="**SuperTypeOverrideChanged"
> >> bind.eventType="change"
> >> bind.zone="gridZone" t:zone="gridZone" />
> >>
> >> I have a bunch of these created in a loop, each with a different
> >> cubeCard.id context value.
> >>
> >> What I'm seeing is that when the value of the field is changed, two
> >> requests are produced:
> >>
> >> 1. /editcube:**supertypeoverridechanged/49
> >> 2. /editcube.supertypeoverride:**change
> >>
> >> The first one contains the important context value and the second one
> >> contains the changed value of the form field in the Request body.  I can
> >> add a handler for both in my page class:
> >>
> >> 1. public Object onSuperTypeOverrideChanged(**Integer cubeCardId)
> >> 2. public void onChangeFromSuperTypeOverride(**)
> >>
> >> But the problem is that I need the context AND the submitted value,
> >> therefore what I'm having to do is basically wait for the second request to
> >> be processed and the value set on the server side before I can process the
> >> request containing the context:
> >>
> >> public Object onSuperTypeOverrideChanged(**Integer cubeCardId) {
> >> Thread.sleep(200);
> >> //processing
> >> return gridZone.getBody();
> >> }
> >>
> >> Clearly this isn't ideal.  So, am I doing something wrong here?  Should I
> >> be getting two requests or just one? Is there anyone else who has
> >> experience with this mixin who can help me out?
> >>
> >> Thanks,
> >> Ben.
> >>
> >>
> >>
> >>
> >
> >
> >
> > ------------------------------**------------------------------**---------
> > To unsubscribe, e-mail: users-unsubscribe@tapestry.**apache.org<us...@tapestry.apache.org>
> > For additional commands, e-mail: users-help@tapestry.apache.org
> >
> >
> 
> 
> -- 
> Sincerely
> *Boris Horvat*
 		 	   		  

Re: jQuery/bind mixin does not submit field value onChange

Posted by Emmanuel DEMEY <de...@gmail.com>.
Yes the 4.0.0 snap is for Tap 5.4. Please use 5.3.7-snap if you are using
tap 5.3
Le 28 mai 2013 21:27, "Boris Horvat" <ho...@gmail.com> a écrit :

> Hm...I am not sure but I would expect that 4.0.0-SNAPSHOT is for upcoming
> release of tapestry 5.4
>
> I would try 3.3.7-SNAPSHOT just in case
>
>
> On Tue, May 28, 2013 at 9:20 PM, George Ludwig <georgeludwig@gmail.com
> >wrote:
>
> > Is that tap5-jquery 3.3.7-SNAPSHOT? I just checked my local copy, and
> it's
> > at 4.0.0-SNAPSHOT. Just a little confused...
> >
> >
> > On Tue, May 28, 2013 at 10:25 AM, Boris Horvat <horvat.z.boris@gmail.com
> > >wrote:
> >
> > > Hi,
> > >
> > > I recently reported a bug whcih I think could be what you are talking
> > > about. This was fixed in the new version 3.3.7-SNAPSHOT, are you using
> > > this?
> > >
> > > Cheers,
> > > Boris
> > >
> > >
> >
>
>
>
> --
> Sincerely
> *Boris Horvat*
>

Re: jQuery/bind mixin does not submit field value onChange

Posted by Boris Horvat <ho...@gmail.com>.
Hm...I am not sure but I would expect that 4.0.0-SNAPSHOT is for upcoming
release of tapestry 5.4

I would try 3.3.7-SNAPSHOT just in case


On Tue, May 28, 2013 at 9:20 PM, George Ludwig <ge...@gmail.com>wrote:

> Is that tap5-jquery 3.3.7-SNAPSHOT? I just checked my local copy, and it's
> at 4.0.0-SNAPSHOT. Just a little confused...
>
>
> On Tue, May 28, 2013 at 10:25 AM, Boris Horvat <horvat.z.boris@gmail.com
> >wrote:
>
> > Hi,
> >
> > I recently reported a bug whcih I think could be what you are talking
> > about. This was fixed in the new version 3.3.7-SNAPSHOT, are you using
> > this?
> >
> > Cheers,
> > Boris
> >
> >
>



-- 
Sincerely
*Boris Horvat*

Re: jQuery/bind mixin does not submit field value onChange

Posted by George Ludwig <ge...@gmail.com>.
Is that tap5-jquery 3.3.7-SNAPSHOT? I just checked my local copy, and it's
at 4.0.0-SNAPSHOT. Just a little confused...


On Tue, May 28, 2013 at 10:25 AM, Boris Horvat <ho...@gmail.com>wrote:

> Hi,
>
> I recently reported a bug whcih I think could be what you are talking
> about. This was fixed in the new version 3.3.7-SNAPSHOT, are you using
> this?
>
> Cheers,
> Boris
>
>

Re: jQuery/bind mixin does not submit field value onChange

Posted by Boris Horvat <ho...@gmail.com>.
Hi,

I recently reported a bug whcih I think could be what you are talking
about. This was fixed in the new version 3.3.7-SNAPSHOT, are you using this?

Cheers,
Boris


On Tue, May 28, 2013 at 4:31 PM, Jens Breitenstein <ma...@j-b-s.de>wrote:

> Hi Ben!
>
> Any particular reason why you need bind for capturing the change event of
> a select?
> This works for me (honestly not tried in a AjaxFormLoop, so don't kill me):
>
>     <t:select class="input-small" t:id="**schoolFinderSearchOption"
> t:validate="required"
>                    blankOption="Always" value="**schoolFinderSearchOptionValue"
> zone="schoolFinderZone"/>
>
> as schoolFinderSearchOptionValue is defined as an Enum Property
>
>     @Property private ESchoolFinderSearchOption _**
> schoolFinderSearchOptionValue;
>
> therefore Tapestry calls
>
>     Object onValueChanged(final ESchoolFinderSearchOption esfso)
>     {
>         ....
>     }
>
>
> I guess due to the fact you have a zone and a jquery/bind at the same time
> you are getting two calls. In case you solely use bind you can send the
> current value as part of the request by adding a callback (this snipped is
> working for me in an AjayFormLoop with a checkbox, so please modify it
> accordingly for your "input field of type select"):
>
>     bind.event="**deleteCheckboxChanged"
>     bind.eventType="change"
>     bind.callback="function(event,**ui,url) { url.addContext(event.target.
> **checked); }"
>
> and this calls
>
>     Object onDeleteCheckboxChanged(final long formEventPk, final String
> state)        // you can even use:     ..., final boolean state) instead of
> string
>     {
>         ...
>     }
>
>
> Jens
>
>
>
>
> Am 28.05.13 13:48, schrieb Ben Titmarsh:
>
>  Hi All,
>>
>> I am using the jQuery bind mixin to respond to 'onChange' events from my
>> form fields, process the change then update the zone.  This is my tml:
>>
>> <t:select t:id="superTypeOverride" t:clientId="superTypeOverride"
>> t:value="cubeCard.**superTypeCombinationOverride"
>> t:mixins="jquery/bind"
>> bind.context="cubeCard.id"
>> bind.event="**SuperTypeOverrideChanged"
>> bind.eventType="change"
>> bind.zone="gridZone" t:zone="gridZone" />
>>
>> I have a bunch of these created in a loop, each with a different
>> cubeCard.id context value.
>>
>> What I'm seeing is that when the value of the field is changed, two
>> requests are produced:
>>
>> 1. /editcube:**supertypeoverridechanged/49
>> 2. /editcube.supertypeoverride:**change
>>
>> The first one contains the important context value and the second one
>> contains the changed value of the form field in the Request body.  I can
>> add a handler for both in my page class:
>>
>> 1. public Object onSuperTypeOverrideChanged(**Integer cubeCardId)
>> 2. public void onChangeFromSuperTypeOverride(**)
>>
>> But the problem is that I need the context AND the submitted value,
>> therefore what I'm having to do is basically wait for the second request to
>> be processed and the value set on the server side before I can process the
>> request containing the context:
>>
>> public Object onSuperTypeOverrideChanged(**Integer cubeCardId) {
>> Thread.sleep(200);
>> //processing
>> return gridZone.getBody();
>> }
>>
>> Clearly this isn't ideal.  So, am I doing something wrong here?  Should I
>> be getting two requests or just one? Is there anyone else who has
>> experience with this mixin who can help me out?
>>
>> Thanks,
>> Ben.
>>
>>
>>
>>
>
>
>
> ------------------------------**------------------------------**---------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.**apache.org<us...@tapestry.apache.org>
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>


-- 
Sincerely
*Boris Horvat*

Re: jQuery/bind mixin does not submit field value onChange

Posted by Jens Breitenstein <ma...@j-b-s.de>.
Hi Ben!

Any particular reason why you need bind for capturing the change event 
of a select?
This works for me (honestly not tried in a AjaxFormLoop, so don't kill me):

     <t:select class="input-small" t:id="schoolFinderSearchOption" 
t:validate="required"
                    blankOption="Always" 
value="schoolFinderSearchOptionValue" zone="schoolFinderZone"/>

as schoolFinderSearchOptionValue is defined as an Enum Property

     @Property private ESchoolFinderSearchOption 
_schoolFinderSearchOptionValue;

therefore Tapestry calls

     Object onValueChanged(final ESchoolFinderSearchOption esfso)
     {
         ....
     }


I guess due to the fact you have a zone and a jquery/bind at the same 
time you are getting two calls. In case you solely use bind you can send 
the current value as part of the request by adding a callback (this 
snipped is working for me in an AjayFormLoop with a checkbox, so please 
modify it accordingly for your "input field of type select"):

     bind.event="deleteCheckboxChanged"
     bind.eventType="change"
     bind.callback="function(event,ui,url) { 
url.addContext(event.target.checked); }"

and this calls

     Object onDeleteCheckboxChanged(final long formEventPk, final String 
state)        // you can even use:     ..., final boolean state) instead 
of string
     {
         ...
     }


Jens




Am 28.05.13 13:48, schrieb Ben Titmarsh:
> Hi All,
>
> I am using the jQuery bind mixin to respond to 'onChange' events from my form fields, process the change then update the zone.  This is my tml:
>
> <t:select t:id="superTypeOverride" t:clientId="superTypeOverride" t:value="cubeCard.superTypeCombinationOverride"
> t:mixins="jquery/bind"
> bind.context="cubeCard.id"
> bind.event="SuperTypeOverrideChanged"
> bind.eventType="change"
> bind.zone="gridZone" t:zone="gridZone" />
>
> I have a bunch of these created in a loop, each with a different cubeCard.id context value.
>
> What I'm seeing is that when the value of the field is changed, two requests are produced:
>
> 1. /editcube:supertypeoverridechanged/49
> 2. /editcube.supertypeoverride:change
>
> The first one contains the important context value and the second one contains the changed value of the form field in the Request body.  I can add a handler for both in my page class:
>
> 1. public Object onSuperTypeOverrideChanged(Integer cubeCardId)
> 2. public void onChangeFromSuperTypeOverride()
>
> But the problem is that I need the context AND the submitted value, therefore what I'm having to do is basically wait for the second request to be processed and the value set on the server side before I can process the request containing the context:
>
> public Object onSuperTypeOverrideChanged(Integer cubeCardId) {
> Thread.sleep(200);
> //processing
> return gridZone.getBody();
> }
>
> Clearly this isn't ideal.  So, am I doing something wrong here?  Should I be getting two requests or just one? Is there anyone else who has experience with this mixin who can help me out?
>
> Thanks,
> Ben.
>
>
>   		 	   		



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