Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » Struts 2 »

Re: [S2] Any hope to have ajax form submission working?

Musachy Barroso

2007-01-20

Replies:

I tried to replicate this, so I added this to index.jsp on showcase
under apps/showcase/src/main/webapp/ajax/remotelink:

<div id="target">
  <s:form id="form" action="/AjaxTest.action" >
   <input type=textbox name="data">
   <s:a theme="ajax" targets="target">Try</s:a>
  </s:form>
</div>

but it works on both IE 6 and FF 2. The anchor and the button share the
same javascript code, so they should behave the same. They can be used
inside a form, in which case they will submit the parent form or outside
a form, using "formId". Adding theme="ajax" to the form should make no
difference on this case. Can you try the above example and let me know
if it works?

thanks
musachy


Dariusz Wojtas wrote:
> Hi Musachy,
>
> Your question to prepare some test form/page gave some results.
> My problem was that I had problems submitting remote forms.
> Submitting with a button had problems, then I tried to submit it with
> the <s:a/> element.
> And it worked in FF but not in IE.
> But I found something interesting after looooong testing :)
>
> Some pseudocode below:
>
> <div id="myParentDIV">
> <form action="/namespace/my.action" theme="ajax">
>   <s:hidden name="id"/>
>   <s:textfield name="name"/>
>   <s:a theme="ajax" targets="myParentDIV">Save</s:a>
> </form>
> </div>
> <div id="mySecondDIV">
> </div>
>
> IE 6
> In this case <s:a> makes request to '/app/namespace/my.action'
> ut does not attach params.
> If I switch <s:a> targets attribute to point to the second div - then
> it works and passes params....
> The only difference that I see is that it is not it's parent div.
>
> Under FF it works in both cases.
>
> Is there any special reason of this behaviour?
> Can it be fixed?
> Now I can easily make workarounds - now I know the reason of failures,
> but can it be fixed?
> Or this is some bug in IE?
>
> Or maybe this is not allowed?
>
> In fact what I tried is that the 'myParentDiv' element is of type
>   <s:div id="myParentDIV" theme="ajax" href="%{someURL}" ...>
> and the form is loaded by the browser in a separate request.
> But I tried to make both div elements to be declared with <s:div> that
> preload their contents. It still works only if the target is not the
> parent div but the other div.
>
> Best Regards
> Dariusz Wojtas
>
> On 1/17/07, Musachy Barroso <mbarroso@(protected):
>> Can you create a ticket with the scenarios that do not work? I'll
>> probably have time to go over it on the weekend.
>>
>> thanks
>> musachy
>>
>> Dariusz Wojtas wrote:
>> > Hi Musachy,
>> >
>> > This is probably lack of precision from my side.
>> > Saying "ajax forms" I thought about remote forms.
>> >
>> > Even having them working with inputs of type submit/image only (no
>> > anchors) - just to have one method of submission that works in all
>> > cases. Currently there are problems with both: anchor and input button
>> > submission.
>> >
>> > At least one submission method that works with remote forms in all
>> > scenarios ....
>> >
>> > Best regards
>> > Dariusz Wojtas
>> >
>> >
>> > On 1/17/07, Musachy Barroso <mbarroso@(protected):
>> >> I think the problem is only with files right? On showcase there are
>> >> several examples (not the remoting forms), like on the div,
>> anchor, and
>> >> button page which work.
>> >>
>> >> regards
>> >> musachy
>> >>
>> >> Dariusz Wojtas wrote:
>> >> > Hi,
>> >> >
>> >> > Does the current form submission come from a problem in dojo?
>> >> > Or is this something else?
>> >> > What are the current conclusions about it?
>> >> >
>> >> > I do not want to be too annoying, this is just important for me.
>> >> > Any chance to have it working within a week or two?
>> >> >
>> >> > Best regards
>> >> > Dariusz Wojtas
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@(protected)
For additional commands, e-mail: user-help@(protected)

©2008 junlu.com - Jax Systems, LLC, U.S.A.