I see. Coming from Tapestry 4.0, I've had great success with the
contrib:XTile component for Ajax, but does require writing some
javascript to handle the callback.
I see in the docs that the form is submitted by default, but am not
clear as to whether the EventListener gets called before the form submit
listener. One slight difference between the example in the link and what
you're attempting is using 'targets' in place of 'elements'.
If this doesn't do it for you, I'd post to the tapestry forum. Please
post back here when you find a resolution.
Cheers,
Mark
caarney wrote:
Hi,
thanks for information, but I want to use AJAX functionality, so I can't use
normal submit (AJAX is faster and it keeps the page scroll position).
Listening to recName events doesn't help neither - the value is still null:
@EventListener(events="onchange", elements="recName")
public void onRefresh(IRequestCycle cycle) {
log.debug(getRecName()); // = null
}
This is the description of autoSubmit parameter of @EventListener:
"When components implementing IFormComponent are targeted they will normally
automatically cause a form submission to happen so that the property they
manage on your form is updated when your listener method is called - this
parameter can be used to disable the automatic submission of the enclosing
form."
... so I think the form should submit and the value of recName should be set
entered value, right?
Is there any difference between elements and targets parameters of
@EventListener?
Maybe I should move this thread to Tapestry forum.
I need to achieve something like this:
http://www.nabble.com/How-to-update-a-selection-model-based-on-a-prior-selection-tf4342042.html#a12368934
TeleMarkR wrote:
Hi Caarney,
I'm new to Tapestry 4.1, but checked the docs for the @EventListener
annotation. The docs say " The EventListener
<http://tapestry.apache.org/tapestry4.1/tapestry-annotations/apidocs/org/apache/tapestry/annotations/EventListener.html>annotation
is attached to listener
<http://tapestry.apache.org/tapestry4.1/tapestry-framework/apidocs/org/apache/tapestry/IActionListener>methods
to dynamically bind and listen to client side browser events.",
which tells me that you're not handling a server-side form post.
You can try something like:
@EventListener(events="onchange", elements="recName") to implement an
AJAX
style handler, or if you just want to handle a simple form post, do
something like:
<form jwcid="@Form" listener="listener:onRefresh"> and remove the
@EventListener annotation. Your onRefresh method should work when the
form
is submitted.
HTH,
Mark
On Dec 5, 2007 8:51 AM, caarney <[EMAIL PROTECTED]> wrote:
Hi,
I'm using Tapestry 4.1.3 and the @EventListener functionality. The
eventlistener method is called correctly, but I can't get any
user-entered
values from the form. As I understood from the documentation, the form
should submit itself by default and send the values to the server, but it
doesn't work for me. I tried to use @Persist annotation for the getter of
the requested value, but it didn't help.
<input jwcid="@TextField" value="ognl:recName" id="recName"
class="text large" type="text" />
@Persist
public abstract String getRecName();
@EventListener(events="onchange", elements="ddRecipient")
public void onRefresh(IRequestCycle cycle) {
log.debug(getRecName()); // this returns null (or initial
value)
}
I presume that the getRecName() function in the EventListener is supposed
to
return the value entered by user - is it right? Am I doing something
wrong?
Thanks
--
View this message in context:
http://www.nabble.com/Tapestry-EventListener-doesn%27t-seem-to-submit-form-tf4950403s2369.html#a14174059
Sent from the AppFuse - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]