You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Kevin Menard <km...@servprise.com> on 2007/12/20 23:18:00 UTC

[T4]: EventListener autoSubmit

Hi,

I've just finally gotten back around to messing with the T4 async stuff.
The first thing I wanted to try was a simple shipping/billing info wizard
where clicking a checkbox labeled "same shipping info" would grab the
shipping info and populate the form on the billing info page.

Generally I have it working.  I can update everything asynchronously, which
is awesome.  The problem I have is getting the checkbox state.  If I use
"elements", the server-side value isn't updated and it appears I can't get
the actual checkbox value from the BrowserEvent.  If I use "targets", the
server-side value is updated, but I can't suppress the form submission.  I
have something like the following:

@EventListener(targets="sameShippingInfo", events="onchange",
autoSubmit=false)
public void copyShippingInfo(final IRequestCycle cycle, final BrowserEvent
event)
{
   ...
}

It seems to me that setting autoSubmit to false should not submit the form,
but it is anyway.  Even if this were working, would that mean that the
server-side value that the checkbox is bound to would not be updated?

Thanks,
Kevin



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


Re: [T4]: EventListener autoSubmit

Posted by Kevin Menard <km...@servprise.com>.
Thinking the matter over a little bit more, there's a fairly straightforward
workaround.  By removing any listener from the form and binding them all to
submit button action values, I can get the desired behavior.  Of course,
this does mean more template changing which is not as transparent as I'd
like, but not terrible either.

The "autoSubmit" parameter seems broken though, so I'll be poking around
JIRA for that.

-- 
Kevin


On 12/20/07 6:55 PM, in article C3906B10.9C88%kmenard@servprise.com, "Kevin
Menard" <km...@servprise.com> wrote:

> On 12/20/07 5:51 PM, in article
> 7926817e0712201451l65ae9727s6d147ba4946d3e53@mail.gmail.com, "Jesse Kuhnert"
> <jk...@gmail.com> wrote:
> 
> 
>> In theory it will take all the arguments to the client side function
>> (including the javascript event,  which should have a
>> target/relatedTarget/etc attribute attached to it) and serialize them
>> in some form that you can then try to interact with in the form of a
>> JSONArray.    I've not used it though so don't know what will happen
>> under which circumstances / etc..
> 
> Ahh.  Cool.  I guess ideally I'd be able to a serialized copy of the DOM
> node, sorta like I can do with jQuery.  Then I could dump the server-side
> value altogether and just use a plain ol' checkbox.
> 
> I guess I'll put EventListener back on the shelf until then.
> 
> Thanks for the info,
> Kevin 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 
> 



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


Re: [T4]: EventListener autoSubmit

Posted by Kevin Menard <km...@servprise.com>.
On 12/20/07 5:51 PM, in article
7926817e0712201451l65ae9727s6d147ba4946d3e53@mail.gmail.com, "Jesse Kuhnert"
<jk...@gmail.com> wrote:


> In theory it will take all the arguments to the client side function
> (including the javascript event,  which should have a
> target/relatedTarget/etc attribute attached to it) and serialize them
> in some form that you can then try to interact with in the form of a
> JSONArray.    I've not used it though so don't know what will happen
> under which circumstances / etc..

Ahh.  Cool.  I guess ideally I'd be able to a serialized copy of the DOM
node, sorta like I can do with jQuery.  Then I could dump the server-side
value altogether and just use a plain ol' checkbox.

I guess I'll put EventListener back on the shelf until then.

Thanks for the info,
Kevin 



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


Re: [T4]: EventListener autoSubmit

Posted by Jesse Kuhnert <jk...@gmail.com>.
Heh...If it were correctly not submitting the form I'm still not sure
if you'd be able to figure out what the value bound to the checkbox
is.

Marcus did add something semi - recently that may actually give you
what you want.   If your BrowserEvent object has a
getMethodArguments() method then you may be in luck. (maybe, don't get
too excited until you try it)

In theory it will take all the arguments to the client side function
(including the javascript event,  which should have a
target/relatedTarget/etc attribute attached to it) and serialize them
in some form that you can then try to interact with in the form of a
JSONArray.    I've not used it though so don't know what will happen
under which circumstances / etc..

On Dec 20, 2007 5:18 PM, Kevin Menard <km...@servprise.com> wrote:
> Hi,
>
> I've just finally gotten back around to messing with the T4 async stuff.
> The first thing I wanted to try was a simple shipping/billing info wizard
> where clicking a checkbox labeled "same shipping info" would grab the
> shipping info and populate the form on the billing info page.
>
> Generally I have it working.  I can update everything asynchronously, which
> is awesome.  The problem I have is getting the checkbox state.  If I use
> "elements", the server-side value isn't updated and it appears I can't get
> the actual checkbox value from the BrowserEvent.  If I use "targets", the
> server-side value is updated, but I can't suppress the form submission.  I
> have something like the following:
>
> @EventListener(targets="sameShippingInfo", events="onchange",
> autoSubmit=false)
> public void copyShippingInfo(final IRequestCycle cycle, final BrowserEvent
> event)
> {
>    ...
> }
>
> It seems to me that setting autoSubmit to false should not submit the form,
> but it is anyway.  Even if this were working, would that mean that the
> server-side value that the checkbox is bound to would not be updated?
>
> Thanks,
> Kevin
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>



-- 
Jesse Kuhnert
Tapestry / OGNL / Dojo team member/developer

Open source based consulting work centered around
dojo/tapestry/tacos/hivemind. http://blog.opencomponentry.com

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