You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Moacir Cardoso <mo...@yahoo.com.br> on 2007/10/02 05:22:57 UTC

Ajax forms not working

Hi,
I'm unable to make my ajax form work

<body>

<div id='two' style="border: 1px solid yellow;"><b>initial content</b></div>
 <s:form
      id="theForm2"
        cssStyle="border: 1px solid green;"
         action="cadastro/pessoa_salvarEndereco.action"
         method="post"
         theme="ajax">
 
     <input type='text' name='data' value='Struts User'>
 
     <s:submit value="GO2" theme="ajax" targets="two"/>
 
 </s:form>

</body>



It's making a normal http request and not using ajax calls.



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Ajax forms not working

Posted by Musachy Barroso <mu...@gmail.com>.
On top of that, that won't work on IE. set showLoadingText="false" on
the submit tag.

musachy

On 10/1/07, Moacir Cardoso <mo...@yahoo.com.br> wrote:
> Hi,
> I'm unable to make my ajax form work
>
> <body>
>
> <div id='two' style="border: 1px solid yellow;"><b>initial content</b></div>
>  <s:form
>       id="theForm2"
>         cssStyle="border: 1px solid green;"
>          action="cadastro/pessoa_salvarEndereco.action"
>          method="post"
>          theme="ajax">
>
>      <input type='text' name='data' value='Struts User'>
>
>      <s:submit value="GO2" theme="ajax" targets="two"/>
>
>  </s:form>
>
> </body>
>
>
>
> It's making a normal http request and not using ajax calls.
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>


-- 
"Hey you! Would you help me to carry the stone?" Pink Floyd

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Ajax forms not working - Problem with scriptaculous and dojo

Posted by Marcos Hernandez <ma...@gmail.com>.
I have the head tag first, then prototype and then Script.aculous and they
work perfectly well with Dojo. Had you switched order?

On 10/5/07, Dave Newton <ne...@yahoo.com> wrote:
>
> At one point the JavaScript load order when using
> Prototype was significant; I had to put the
> <s:head.../> tag before loading prototype.
>
> Note that Prototype does not always play well with
> other libraries.
>
> d.
>
> --- Moacir Cardoso <mo...@yahoo.com.br> wrote:
>
> > Hello people,
> >
> > I was unable to make my ajax s:form submit to work.
> > Then I tried to create a simple application from
> > struts2-blank-2.0.9.war
> > like this:
> >
> > <%@ taglib prefix="s" uri="/struts-tags" %>
> > <%@ page language="java" contentType="text/html;
> > charset=ISO-8859-1"
> > pageEncoding="ISO-8859-1"%>
> > <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01
> > Transitional//EN"
> > "http://www.w3.org/TR/html4/loose.dtd">
> > <html>
> > <head>
> > <meta http-equiv="Content-Type" content="text/html;
> > charset=ISO-8859-1">
> > <title>Hello Jsp</title>
> > <s:head debug="true" theme="ajax"/>
> > </head>
> > <body>
> >     <s:form action="HelloAjax_Table">
> >         <s:textfield name="txtNome"></s:textfield>
> >
> >         <s:submit value="Send Ajax" theme="ajax"
> > targets="div1"></s:submit>
> >     </s:form>  <br/>
> >     Div1: <br/>
> >     <div id="div1"></div>
> > </body>
> > </html>
> >
> > The result was fine, but if I add scriptaculous and
> > prototype.js an
> > error occurs.
> >
> > <head>
> > <script src="<%= request.getContextPath()
> > %>/js/scriptaculous/lib/prototype.js"
> > type="text/javascript"></script>
> > <script src="<%= request.getContextPath()
> > %>/js/scriptaculous/src/scriptaculous.js"
> > type="text/javascript"></script>
> > ...
> >
> > FATAL exception raised: Could not load
> > 'struts.widget.Bind'; last tried
> > '__package__.js'
> >
> > So, probably dojo have some problems with
> > scriptaculous or prototype.js.
> > Note that the tag <s:head debug="true"
> > theme="ajax"/> will output some
> > dojo scripts.
> >
> > Becouse that I will not use dojo anymore and  start
> > with scriptaculous
> > and prototype.js.
> >
> > Bye.
> >
> >
> > Dave Newton escreveu:
> > > If you set the debug flag do you get any error
> > > messages?
> > >
> > > --- Moacir Cardoso <mo...@yahoo.com.br> wrote:
> > >
> > >
> > >> Yes I do.
> > >>
> > >>
> > >>
> > >> Dave Newton wrote:
> > >>
> > >>> Do you have an <s:head theme="ajax"/> tag?
> > >>>
> > >>> --- Moacir Cardoso <mo...@yahoo.com.br> wrote:
> > >>>
> > >>>
> > >>>
> > >>>> Hi,
> > >>>> I'm unable to make my ajax form work
> > >>>>
> > >>>> <body>
> > >>>>
> > >>>> <div id='two' style="border: 1px solid
> > >>>> yellow;"><b>initial content</b></div>
> > >>>>  <s:form
> > >>>>       id="theForm2"
> > >>>>         cssStyle="border: 1px solid green;"
> > >>>>
> > >>>> action="cadastro/pessoa_salvarEndereco.action"
> > >>>>          method="post"
> > >>>>          theme="ajax">
> > >>>>
> > >>>>      <input type='text' name='data'
> > value='Struts
> > >>>> User'>
> > >>>>
> > >>>>      <s:submit value="GO2" theme="ajax"
> > >>>> targets="two"/>
> > >>>>
> > >>>>  </s:form>
> > >>>>
> > >>>> </body>
> > >>>>
> > >>>>
> > >>>>
> > >>>> It's making a normal http request and not using
> > >>>>
> > >> ajax
> > >>
> > >>>> calls.
> > >>>>
> > >>>>
> > >>>>
> > >>>>
> > >>>>
> > >>>>
> > >
> >
> ---------------------------------------------------------------------
> > >
> > >>>
> > >>>
> > >>>> To unsubscribe, e-mail:
> > >>>> user-unsubscribe@struts.apache.org
> > >>>> For additional commands, e-mail:
> > >>>> user-help@struts.apache.org
> > >>>>
> > >>>>
> > >>>>
> > >>>>
> > >>>
> > >>>
> > >
> >
> ---------------------------------------------------------------------
> > >
> > >>> To unsubscribe, e-mail:
> > >>>
> > >> user-unsubscribe@struts.apache.org
> > >>
> > >>> For additional commands, e-mail:
> > >>>
> > >> user-help@struts.apache.org
> > >>
> > >>>
> > >>>
> > >>>
> > >>
> > >>
> > >
> >
> ---------------------------------------------------------------------
> > >
> > >> To unsubscribe, e-mail:
> > >> user-unsubscribe@struts.apache.org
> > >> For additional commands, e-mail:
> > >> user-help@struts.apache.org
> > >>
> > >>
> > >>
> > >
> > >
> > >
> >
> ---------------------------------------------------------------------
> > > To unsubscribe, e-mail:
> > user-unsubscribe@struts.apache.org
> > > For additional commands, e-mail:
> > user-help@struts.apache.org
> > >
> > >
> > >
> > >
> >
> >
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> > user-unsubscribe@struts.apache.org
> > For additional commands, e-mail:
> > user-help@struts.apache.org
> >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>


-- 
- Marcos H.
________________________________________
You must be the change you wish to see in the world
~ Gandhi

Re: Ajax forms not working - Problem with scriptaculous and dojo

Posted by Dave Newton <ne...@yahoo.com>.
At one point the JavaScript load order when using
Prototype was significant; I had to put the
<s:head.../> tag before loading prototype.

Note that Prototype does not always play well with
other libraries.

d.

--- Moacir Cardoso <mo...@yahoo.com.br> wrote:

> Hello people,
> 
> I was unable to make my ajax s:form submit to work.
> Then I tried to create a simple application from
> struts2-blank-2.0.9.war 
> like this:
> 
> <%@ taglib prefix="s" uri="/struts-tags" %>
> <%@ page language="java" contentType="text/html;
> charset=ISO-8859-1" 
> pageEncoding="ISO-8859-1"%>
> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01
> Transitional//EN" 
> "http://www.w3.org/TR/html4/loose.dtd">
> <html>
> <head>
> <meta http-equiv="Content-Type" content="text/html;
> charset=ISO-8859-1">
> <title>Hello Jsp</title>
> <s:head debug="true" theme="ajax"/>
> </head>
> <body>
>     <s:form action="HelloAjax_Table">  
>         <s:textfield name="txtNome"></s:textfield>  
>    
>         <s:submit value="Send Ajax" theme="ajax" 
> targets="div1"></s:submit>  
>     </s:form>  <br/>
>     Div1: <br/>
>     <div id="div1"></div>
> </body>
> </html>
> 
> The result was fine, but if I add scriptaculous and
> prototype.js an 
> error occurs.
> 
> <head>
> <script src="<%= request.getContextPath() 
> %>/js/scriptaculous/lib/prototype.js"
> type="text/javascript"></script>
> <script src="<%= request.getContextPath() 
> %>/js/scriptaculous/src/scriptaculous.js"
> type="text/javascript"></script>
> ...
> 
> FATAL exception raised: Could not load
> 'struts.widget.Bind'; last tried 
> '__package__.js'
> 
> So, probably dojo have some problems with
> scriptaculous or prototype.js.
> Note that the tag <s:head debug="true"
> theme="ajax"/> will output some 
> dojo scripts.
> 
> Becouse that I will not use dojo anymore and  start
> with scriptaculous 
> and prototype.js.
> 
> Bye.
> 
> 
> Dave Newton escreveu:
> > If you set the debug flag do you get any error
> > messages?
> >
> > --- Moacir Cardoso <mo...@yahoo.com.br> wrote:
> >
> >   
> >> Yes I do.
> >>
> >>
> >>
> >> Dave Newton wrote:
> >>     
> >>> Do you have an <s:head theme="ajax"/> tag?
> >>>
> >>> --- Moacir Cardoso <mo...@yahoo.com.br> wrote:
> >>>
> >>>   
> >>>       
> >>>> Hi,
> >>>> I'm unable to make my ajax form work
> >>>>
> >>>> <body>
> >>>>
> >>>> <div id='two' style="border: 1px solid
> >>>> yellow;"><b>initial content</b></div>
> >>>>  <s:form
> >>>>       id="theForm2"
> >>>>         cssStyle="border: 1px solid green;"
> >>>>         
> >>>> action="cadastro/pessoa_salvarEndereco.action"
> >>>>          method="post"
> >>>>          theme="ajax">
> >>>>  
> >>>>      <input type='text' name='data'
> value='Struts
> >>>> User'>
> >>>>  
> >>>>      <s:submit value="GO2" theme="ajax"
> >>>> targets="two"/>
> >>>>  
> >>>>  </s:form>
> >>>>
> >>>> </body>
> >>>>
> >>>>
> >>>>
> >>>> It's making a normal http request and not using
> >>>>         
> >> ajax
> >>     
> >>>> calls.
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>     
> >>>>         
> >
>
---------------------------------------------------------------------
> >   
> >>>   
> >>>       
> >>>> To unsubscribe, e-mail:
> >>>> user-unsubscribe@struts.apache.org
> >>>> For additional commands, e-mail:
> >>>> user-help@struts.apache.org
> >>>>
> >>>>
> >>>>     
> >>>>         
> >>>
> >>>       
> >
>
---------------------------------------------------------------------
> >   
> >>> To unsubscribe, e-mail:
> >>>       
> >> user-unsubscribe@struts.apache.org
> >>     
> >>> For additional commands, e-mail:
> >>>       
> >> user-help@struts.apache.org
> >>     
> >>>
> >>>   
> >>>       
> >>
> >>     
> >
>
---------------------------------------------------------------------
> >   
> >> To unsubscribe, e-mail:
> >> user-unsubscribe@struts.apache.org
> >> For additional commands, e-mail:
> >> user-help@struts.apache.org
> >>
> >>
> >>     
> >
> >
> >
>
---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> user-unsubscribe@struts.apache.org
> > For additional commands, e-mail:
> user-help@struts.apache.org
> >
> >
> >
> >   
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> user-unsubscribe@struts.apache.org
> For additional commands, e-mail:
> user-help@struts.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Ajax forms not working - Problem with scriptaculous and dojo

Posted by Moacir Cardoso <mo...@yahoo.com.br>.
Hello people,

I was unable to make my ajax s:form submit to work.
Then I tried to create a simple application from struts2-blank-2.0.9.war 
like this:

<%@ taglib prefix="s" uri="/struts-tags" %>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1" 
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" 
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Hello Jsp</title>
<s:head debug="true" theme="ajax"/>
</head>
<body>
    <s:form action="HelloAjax_Table">  
        <s:textfield name="txtNome"></s:textfield>      
        <s:submit value="Send Ajax" theme="ajax" 
targets="div1"></s:submit>  
    </s:form>  <br/>
    Div1: <br/>
    <div id="div1"></div>
</body>
</html>

The result was fine, but if I add scriptaculous and prototype.js an 
error occurs.

<head>
<script src="<%= request.getContextPath() 
%>/js/scriptaculous/lib/prototype.js" type="text/javascript"></script>
<script src="<%= request.getContextPath() 
%>/js/scriptaculous/src/scriptaculous.js" type="text/javascript"></script>
...

FATAL exception raised: Could not load 'struts.widget.Bind'; last tried 
'__package__.js'

So, probably dojo have some problems with scriptaculous or prototype.js.
Note that the tag <s:head debug="true" theme="ajax"/> will output some 
dojo scripts.

Becouse that I will not use dojo anymore and  start with scriptaculous 
and prototype.js.

Bye.


Dave Newton escreveu:
> If you set the debug flag do you get any error
> messages?
>
> --- Moacir Cardoso <mo...@yahoo.com.br> wrote:
>
>   
>> Yes I do.
>>
>>
>>
>> Dave Newton wrote:
>>     
>>> Do you have an <s:head theme="ajax"/> tag?
>>>
>>> --- Moacir Cardoso <mo...@yahoo.com.br> wrote:
>>>
>>>   
>>>       
>>>> Hi,
>>>> I'm unable to make my ajax form work
>>>>
>>>> <body>
>>>>
>>>> <div id='two' style="border: 1px solid
>>>> yellow;"><b>initial content</b></div>
>>>>  <s:form
>>>>       id="theForm2"
>>>>         cssStyle="border: 1px solid green;"
>>>>         
>>>> action="cadastro/pessoa_salvarEndereco.action"
>>>>          method="post"
>>>>          theme="ajax">
>>>>  
>>>>      <input type='text' name='data' value='Struts
>>>> User'>
>>>>  
>>>>      <s:submit value="GO2" theme="ajax"
>>>> targets="two"/>
>>>>  
>>>>  </s:form>
>>>>
>>>> </body>
>>>>
>>>>
>>>>
>>>> It's making a normal http request and not using
>>>>         
>> ajax
>>     
>>>> calls.
>>>>
>>>>
>>>>
>>>>
>>>>     
>>>>         
> ---------------------------------------------------------------------
>   
>>>   
>>>       
>>>> To unsubscribe, e-mail:
>>>> user-unsubscribe@struts.apache.org
>>>> For additional commands, e-mail:
>>>> user-help@struts.apache.org
>>>>
>>>>
>>>>     
>>>>         
>>>
>>>       
> ---------------------------------------------------------------------
>   
>>> To unsubscribe, e-mail:
>>>       
>> user-unsubscribe@struts.apache.org
>>     
>>> For additional commands, e-mail:
>>>       
>> user-help@struts.apache.org
>>     
>>>
>>>   
>>>       
>>
>>     
> ---------------------------------------------------------------------
>   
>> To unsubscribe, e-mail:
>> user-unsubscribe@struts.apache.org
>> For additional commands, e-mail:
>> user-help@struts.apache.org
>>
>>
>>     
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
>
>   


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Ajax forms not working

Posted by Dave Newton <ne...@yahoo.com>.
If you set the debug flag do you get any error
messages?

--- Moacir Cardoso <mo...@yahoo.com.br> wrote:

> Yes I do.
> 
> 
> 
> Dave Newton wrote:
> > Do you have an <s:head theme="ajax"/> tag?
> >
> > --- Moacir Cardoso <mo...@yahoo.com.br> wrote:
> >
> >   
> >> Hi,
> >> I'm unable to make my ajax form work
> >>
> >> <body>
> >>
> >> <div id='two' style="border: 1px solid
> >> yellow;"><b>initial content</b></div>
> >>  <s:form
> >>       id="theForm2"
> >>         cssStyle="border: 1px solid green;"
> >>         
> >> action="cadastro/pessoa_salvarEndereco.action"
> >>          method="post"
> >>          theme="ajax">
> >>  
> >>      <input type='text' name='data' value='Struts
> >> User'>
> >>  
> >>      <s:submit value="GO2" theme="ajax"
> >> targets="two"/>
> >>  
> >>  </s:form>
> >>
> >> </body>
> >>
> >>
> >>
> >> It's making a normal http request and not using
> ajax
> >> calls.
> >>
> >>
> >>
> >>
> >>     
> >
>
---------------------------------------------------------------------
> >   
> >> To unsubscribe, e-mail:
> >> user-unsubscribe@struts.apache.org
> >> For additional commands, e-mail:
> >> user-help@struts.apache.org
> >>
> >>
> >>     
> >
> >
> >
>
---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> user-unsubscribe@struts.apache.org
> > For additional commands, e-mail:
> user-help@struts.apache.org
> >
> >
> >
> >   
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> user-unsubscribe@struts.apache.org
> For additional commands, e-mail:
> user-help@struts.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Ajax forms not working

Posted by Moacir Cardoso <mo...@yahoo.com.br>.
Yes I do.



Dave Newton wrote:
> Do you have an <s:head theme="ajax"/> tag?
>
> --- Moacir Cardoso <mo...@yahoo.com.br> wrote:
>
>   
>> Hi,
>> I'm unable to make my ajax form work
>>
>> <body>
>>
>> <div id='two' style="border: 1px solid
>> yellow;"><b>initial content</b></div>
>>  <s:form
>>       id="theForm2"
>>         cssStyle="border: 1px solid green;"
>>         
>> action="cadastro/pessoa_salvarEndereco.action"
>>          method="post"
>>          theme="ajax">
>>  
>>      <input type='text' name='data' value='Struts
>> User'>
>>  
>>      <s:submit value="GO2" theme="ajax"
>> targets="two"/>
>>  
>>  </s:form>
>>
>> </body>
>>
>>
>>
>> It's making a normal http request and not using ajax
>> calls.
>>
>>
>>
>>
>>     
> ---------------------------------------------------------------------
>   
>> To unsubscribe, e-mail:
>> user-unsubscribe@struts.apache.org
>> For additional commands, e-mail:
>> user-help@struts.apache.org
>>
>>
>>     
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
>
>   


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Ajax forms not working

Posted by Dave Newton <ne...@yahoo.com>.
Do you have an <s:head theme="ajax"/> tag?

--- Moacir Cardoso <mo...@yahoo.com.br> wrote:

> Hi,
> I'm unable to make my ajax form work
> 
> <body>
> 
> <div id='two' style="border: 1px solid
> yellow;"><b>initial content</b></div>
>  <s:form
>       id="theForm2"
>         cssStyle="border: 1px solid green;"
>         
> action="cadastro/pessoa_salvarEndereco.action"
>          method="post"
>          theme="ajax">
>  
>      <input type='text' name='data' value='Struts
> User'>
>  
>      <s:submit value="GO2" theme="ajax"
> targets="two"/>
>  
>  </s:form>
> 
> </body>
> 
> 
> 
> It's making a normal http request and not using ajax
> calls.
> 
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> user-unsubscribe@struts.apache.org
> For additional commands, e-mail:
> user-help@struts.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org