ink()
>> >>>>>>>>{
>> >>>>>>>>System.out.println("catched!!");
>> >>>>>>>>return "catched!";
>> >>>>>>>>}
>> >>>>>>>>
>> >>>>>>>> Do you 've got any idea what causes this behavior?
>> >>>>>>>>
>> >>>>>>>> Thanks,
>> >>>>>>>> Geert-Jan
>>
;>>>>>>>
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>> I would suggest that you use AJAX instead of doing the form
> >>>>>>>>> submit.
> >>>>>>>>>
;> did
>>>>>>>>> this
>>>>>>>>> successfully for some simple events also.
>>>>>>>>
;>>>> Shortly, here's how i did it:
>>>>>>>>>>
>>>>>>>>>> In my page i have these two javascript functions:
>>>>>>>>>>
>>>&
Hugo defined myAction as returning a StreamResponse -> no redirect.
Geert-Jan says myAction returns void -> a redirect occurs.
Cheers,
Nick.
Hugo Palma wrote:
If your getting a page redirect then your doing something wrong in your
code.
If you post it i can try and find the problem.
Britske
If your getting a page redirect then your doing something wrong in your
code.
If you post it i can try and find the problem.
Britske wrote:
after the onchange occurs, this is what happens in my app:
1. onMyAction is executed() (this is an actionlink which returns nothing
(void) which results
ant with the server response
>>>>>>> }
>>>>>>> // -->
>>>>>>>
>>>>>>> function sendRequest() {
>>>>>>> new Ajax.Request('${theLink}', {asynchronous:true,
>>>>>>> onSuccess:handleResponse});
>>>>>>> }
>>>>>>>
>>>>>>> On the page class i have:
>>>>>>>
>>&g
Why do you say a redirect happens ? Does your page refresh when you
change the selectbox value ?
It won't refresh because all your doing is call a javascript function.
There's no redirect.
Britske wrote:
since your example effectively calls a ActionLink through AJAX, a redirect
DOES happen. It
sponse onMyAction() {
>>>>> Collection castas =
>>>>> _regiaoDao.getRegiao(regiao).getCastas();
>>>>>
>>>>> JSONObject jsonObject = new JSONObject();
>>>>> // Add whatever info you want to send to the client
>
you want with the server response
>>>>>>> }
>>>>>>> // -->
>>>>>>>
>>>>>>> function sendRequest() {
>>>>>>> new Ajax.Request('${theLink}', {asynchronous:true,
>>>>>>> onSuccess:handleResponse});
>>>>>>> }
>>>>>>>
>>>>>>> On the page class i have:
>>>>>>>
>>>>>
The example i provided fires the call to the server whenever the
javascript function is called.
So, if you call the function from an onchange event on a select the
method will be called every time you change the selectbox.
Britske wrote:
Yeah i see/know, but for the discussion say that
Collection castas =
>>>>> _regiaoDao.getRegiao(regiao).getCastas();
>>>>>
>>>>> JSONObject jsonObject = new JSONObject();
>>>>> // Add whatever info you want to send to the client
>>>>>
>>>>> return new TextStreamResponse("text/xml",
>>>>> jsonObject.toString());
The method i suggested is implemented so that you don't have to submit
the form. That's what AJAX is all about, you make a request to the
server and then update a portion of your page based on the response from
the server using javascript. There's no page reload of for submission.
Britske wrot
>>> sendRequest function from whatever javascript event you want to catch.
>>> Hope this helps.
>>>
>>> Britske wrote:
>>>
>>>> I have a use-case in which i need to catch a onchange of of
>>>> select-component
>>>> on the
That's the way it's supposed to be.
You only see the getTheLink method executed once because that what it
need to replace ${theLink} in your template with the correct link that
is returned from your method. This is done once when the page renders.
If you look at the rendered page source you won
ing snippet doesn't give a server side
>> onsubmit()-event:
>>
>>
>>
>> > onchange="this.form.submit();"/>
>>
>>
>>
>>
>> However, the following does:
>>
>>
>>
>> > onchange=&q
I would suggest that you use AJAX instead of doing the form submit.
Although the AJAX integration in T5 is still not implemented it's very
easy to do using the provided prototype and json javascripts. I did this
successfully for some simple events also.
Shortly, here's how i did it:
In my page
s isn't expected behavior since both examples do work with plain html
form elements.
anyone?
Geert-Jan
--
View this message in context:
http://www.nabble.com/t5-form-submit-not-fired-tf4645307.html#a13269213
Sent from the Tapestry - User mail
18 matches
Mail list logo