thanks a bunch! I'll try it out :)

cheers,
Ulf

> Date: Wed, 11 Feb 2009 17:51:56 +0000
> Subject: Re: submitting a form without a submit button ajax-style
> From: felipefr...@gmail.com
> To: user@struts.apache.org
> 
> Hello,
> 
> Using Struts 2 built-in dojo, you could just:
> 
> function submitForm(namespace, action, formName, targetDivName) {
>       var theForm = dojo.byId( formName );
>       //remove initial slash
>       var theUrl = namespace.substring(1,namespace.length) + "/" + action +
> ".action";
>       dojo.io.bind({
>               url: theUrl,
>               formNode: theForm,
>               load : function(type, data) {  dojo.byId( targetDivName 
> ).innerHTML = data;},
>               error: function(type, error){  dojo.byId( targetDivName 
> ).innerHTML
> = error.message;  },
>               mimeType :"text/html",
>               method: "POST"
>       });
> }
> 
> If you suppress the url, the form action is used instead.
> 
> 
> Regards,
> 
> Felipe Fraga
> 
> 
> On Wed, Feb 11, 2009 at 2:55 PM, mitch gorman <mgor...@shadowtv.biz> wrote:
> > ulf n wrote:
> >> Thanks for all the input on this one!
> >>
> >> alas the form.submit(), causes a reload of the page :(
> >>
> >    doh!
> >
> >    okay, so the issue is, you need the 'targets=""' attribute, but
> > unfortunately for you, s:select doesn't have that bad boy.  what i think
> > you'll need to do, to get around this is to use listenTopics="/after" on
> > the s:div you're trying to update, and change submitForm() to
> >
> >
> > <script type="text/javascript">
> >    function submitForm(id) {
> >        var form = document.getElementById(id);
> >        form.submit();
> >        dojo.event.topic.publish('/after');
> >    }
> > </script>
> >
> >    i have not tested this, so i'm not certain this will work.  it's
> > possible (but unlikely) that the publish might need to occur before the
> > form.submit(), so try that, too, if the function shown above doesn't do
> > the job.
> >
> >    if this doesn't work for ya, i got nothin'.  good luck.
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> > For additional commands, e-mail: user-h...@struts.apache.org
> >
> >
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
> 

_________________________________________________________________
Drag n’ drop—Get easy photo sharing with Windows Live™ Photos.

http://www.microsoft.com/windows/windowslive/products/photos.aspx

Reply via email to