You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Scott Nesbitt <sc...@yahoo.com> on 2007/05/02 16:55:16 UTC

S2: submit tag and handler

Does anyone know how to invoke a request from a submit
handler function?


I am using a submit tag like this:

<div id="t1">Div 1</div>
<s:url id="ajaxTest" value="SaveLineup.action" />
<img id="indicator" 
     src="images/indicator.gif" 
     alt="Loading..." 
     style="display:none"/>
<s:submit type="submit" 
          theme="ajax" 
          value="Save" 
          title="Save all changes."
          cssClass="butstylewide"
          targets="t1" 
          handler="handler"
          notifyTopics="/after"
          href="%{ajaxTest}" 
          align="left" 
          indicator="indicator"/>

My Javascript looks like this:

function handler(widget, node)
{
   alert("DEBUG in handler");
}

dojo.event.topic.subscribe("/after", function(data,
type, e)
{
   alert("Lineup saved");
});

The documentation says this:

'handler' is the name of the function that will take
care of making the AJAX request. Dojo's widget and dom
node are passed as parameters).

But I do not see any example of how to actually do
that.  I guess it is some Dojo magic but looking
through the Dojo documentation has not proved
illuminating.  (BTW, I know if I do not have handler
specified it calls the action but I need to do some
JavaScript work beforehand.)

Thanks,

Scott

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

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


Re: S2: submit tag and handler

Posted by Scott Nesbitt <sc...@yahoo.com>.
Ahh, notifyTopics.  Sweet, sweet, notifyTopics.

I guess the reason I did not use notifyTopics before
is that I did not understand it.  I now have the
"before" working great, and as soon as I figure out
how to indicate success in the action (guess it is not
just return SUCCESS;) I am sure the "load" will work
fine, too.

Thanks again for the help, Musachy.

Scott

--- Musachy Barroso <mu...@gmail.com> wrote:

> I should have asked this first, if all you want to
> do is do something before
> the request, why don't you use "notifyTopics"?
> 
> musachy
> 
> //if you really have to hack around reloadContent,
> it is defined here:
> 
>
http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/struts/widget/Bind.js?view=markup
> 
> On 5/3/07, Scott Nesbitt <sc...@yahoo.com>
> wrote:
> >
> >
> > Anybody have a suggestion on this?  Or do I just
> need
> > to wait until the next version of Struts?
> >
> > Thanks,
> >
> > Scott
> >
> > --- Scott Nesbitt <sc...@yahoo.com> wrote:
> >
> > >
> > > Well, I tried this:
> > >
> > > function handler(widget, node)
> > > {
> > >    var beforeTopicsArray =
> > > widget.beforeNotifyTopicsArray;
> > >    widget.beforeNotifyTopicsArray = null;
> > >    widget.reloadContents();
> > >    widget.beforeNotifyTopicsArray =
> > > beforeTopicsArray;
> > > }
> > >
> > > and now I do not get a stack overflow, but the
> > > action
> > > is still not getting called.
> > >
> > > Scott
> > >
> > > --- Musachy Barroso <mu...@gmail.com> wrote:
> > >
> > > > My bad, the notifyTopics are published inside
> that
> > > > function so it won't
> > > > work. Warning: Hack ahead :)
> > > >
> > > > var beforeTopicsArray =
> > > > widget.beforeNotifyTopicsArray;
> > > > widget.beforeNotifyTopicsArray = null;
> > > > widget.reloadContents();
> > > > widget.beforeNotifyTopicsArray =
> > > beforeTopicsArray;
> > > >
> > > > I will add a "refreshContent" method that will
> be
> > > > common for all of the
> > > > widgets (and part of the api), with one
> > > > parameter(boolean), to skip the
> > > > publishing of the topics.
> > > >
> > > > musachy
> > > >
> > > > On 5/2/07, Scott Nesbitt
> <sc...@yahoo.com>
> > > > wrote:
> > > > >
> > > > >
> > > > > Hmm, this:
> > > > >
> > > > > function handler(widget, node)
> > > > > {
> > > > >    widget.reloadContents();
> > > > > }
> > > > >
> > > > > Gives "Stack overflow at line: 4872"
> > > > >
> > > > > Scott
> > > > >
> > > > > --- Musachy Barroso <mu...@gmail.com>
> wrote:
> > > > >
> > > > > > If you are using submit, or anchor tag you
> can
> > > > call
> > > > > > "reloadContents()" on
> > > > > > the widget passed as a parameter, if you
> are
> > > > using
> > > > > > the div tag, you can call
> > > > > > "refresh()" on it. These functions are not
> > > > really
> > > > > > part of the api and might
> > > > > > change in the future (although it would be
> > > nice
> > > > if
> > > > > > they were right?).
> > > > > >
> > > > > > musachy
> > > > > >
> > > > > > On 5/2/07, Scott Nesbitt
> > > > <sc...@yahoo.com>
> > > > > > wrote:
> > > > > > >
> > > > > > >
> > > > > > > Yes, I would like to do the request in
> the
> > > > > > JavaScript
> > > > > > > because I need to do some other work
> there
> > > > before
> > > > > > the
> > > > > > > request happens.
> > > > > > >
> > > > > > > If I knew how Struts did the request I
> would
> > > > just
> > > > > > do
> > > > > > > the same thing at the bottom of my
> function.
> > > > > > >
> > > > > > > Scott
> > > > > > >
> > > > > > > --- Musachy Barroso <mu...@gmail.com>
> > > wrote:
> > > > > > >
> > > > > > > > The whole idea behind the "handler"
> > > function
> > > > is
> > > > > > that
> > > > > > > > you are going to make
> > > > > > > > the request yourself, instead of
> letting
> > > > struts
> > > > > > do
> > > > > > > > it for you. The handler
> > > > > > > > is just a plain javascript function
> like:
> > > > > > > >
> > > > > > > > function superHandler(widget, domNode)
> {
> > > > > > > >   //use some other framework to do the
> > > ajax
> > > > > > request,
> > > > > > > > Dojo, Prototype, YUI,
> > > > > > > > DWR, JQuery,....zillion_framework_name
> > > > > > > > }
> > > > > > > >
> > > > > > > > is that what you are trying to do? do
> the
> > > > > > request
> > > > > > > > yourself?
> > > > > > > >
> > > > > > > > musachy
> > > > > > > >
> > > > > > > > On 5/2/07, Scott Nesbitt
> > > > > > <sc...@yahoo.com>
> > > > > > > > wrote:
> > > > > > > > >
> > > > > > > > > Does anyone know how to invoke a
> request
> > > > from
> > > > > > a
> > > > > > > > submit
> > > > > > > > > handler function?
> > > > > > > > >
> > > > > > > > >
> > > > > > > > > I am using a submit tag like this:
> > > > > > > > >
> > > > > > > > > <div id="t1">Div 1</div>
> > > > > > > > > <s:url id="ajaxTest"
> > > > value="SaveLineup.action"
> > > > > > />
> > > > > > > > > <img id="indicator"
> > > > > > > > >      src="images/indicator.gif"
> > > > > > > > >      alt="Loading..."
> > > > > > > > >      style="display:none"/>
> > > > > > > > > <s:submit type="submit"
> > > > > > > > >           theme="ajax"
> > > > > > > > >           value="Save"
> > > > > > > > >           title="Save all changes."
> > > > > > > > >           cssClass="butstylewide"
> > > > > > > > >           targets="t1"
> > > > > > > > >           handler="handler"
> > > > > > > > >           notifyTopics="/after"
> > > > > > > > >           href="%{ajaxTest}"
> > > > > > > > >           align="left"
> > > > > > > > >           indicator="indicator"/>
> > > > > > > > >
> > > > > > > > > My Javascript looks like this:
> > > > > > > > >
> > > > > > > > > function handler(widget, node)
> > > > > > > > > {
> > > > > > > > >    alert("DEBUG in handler");
> > > > > > > > > }
> > > > > > > > >
> > > > > > > > > dojo.event.topic.subscribe("/after",
> 
=== message truncated ===



__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

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


Re: S2: submit tag and handler

Posted by Musachy Barroso <mu...@gmail.com>.
I should have asked this first, if all you want to do is do something before
the request, why don't you use "notifyTopics"?

musachy

//if you really have to hack around reloadContent, it is defined here:

http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/struts/widget/Bind.js?view=markup

On 5/3/07, Scott Nesbitt <sc...@yahoo.com> wrote:
>
>
> Anybody have a suggestion on this?  Or do I just need
> to wait until the next version of Struts?
>
> Thanks,
>
> Scott
>
> --- Scott Nesbitt <sc...@yahoo.com> wrote:
>
> >
> > Well, I tried this:
> >
> > function handler(widget, node)
> > {
> >    var beforeTopicsArray =
> > widget.beforeNotifyTopicsArray;
> >    widget.beforeNotifyTopicsArray = null;
> >    widget.reloadContents();
> >    widget.beforeNotifyTopicsArray =
> > beforeTopicsArray;
> > }
> >
> > and now I do not get a stack overflow, but the
> > action
> > is still not getting called.
> >
> > Scott
> >
> > --- Musachy Barroso <mu...@gmail.com> wrote:
> >
> > > My bad, the notifyTopics are published inside that
> > > function so it won't
> > > work. Warning: Hack ahead :)
> > >
> > > var beforeTopicsArray =
> > > widget.beforeNotifyTopicsArray;
> > > widget.beforeNotifyTopicsArray = null;
> > > widget.reloadContents();
> > > widget.beforeNotifyTopicsArray =
> > beforeTopicsArray;
> > >
> > > I will add a "refreshContent" method that will be
> > > common for all of the
> > > widgets (and part of the api), with one
> > > parameter(boolean), to skip the
> > > publishing of the topics.
> > >
> > > musachy
> > >
> > > On 5/2/07, Scott Nesbitt <sc...@yahoo.com>
> > > wrote:
> > > >
> > > >
> > > > Hmm, this:
> > > >
> > > > function handler(widget, node)
> > > > {
> > > >    widget.reloadContents();
> > > > }
> > > >
> > > > Gives "Stack overflow at line: 4872"
> > > >
> > > > Scott
> > > >
> > > > --- Musachy Barroso <mu...@gmail.com> wrote:
> > > >
> > > > > If you are using submit, or anchor tag you can
> > > call
> > > > > "reloadContents()" on
> > > > > the widget passed as a parameter, if you are
> > > using
> > > > > the div tag, you can call
> > > > > "refresh()" on it. These functions are not
> > > really
> > > > > part of the api and might
> > > > > change in the future (although it would be
> > nice
> > > if
> > > > > they were right?).
> > > > >
> > > > > musachy
> > > > >
> > > > > On 5/2/07, Scott Nesbitt
> > > <sc...@yahoo.com>
> > > > > wrote:
> > > > > >
> > > > > >
> > > > > > Yes, I would like to do the request in the
> > > > > JavaScript
> > > > > > because I need to do some other work there
> > > before
> > > > > the
> > > > > > request happens.
> > > > > >
> > > > > > If I knew how Struts did the request I would
> > > just
> > > > > do
> > > > > > the same thing at the bottom of my function.
> > > > > >
> > > > > > Scott
> > > > > >
> > > > > > --- Musachy Barroso <mu...@gmail.com>
> > wrote:
> > > > > >
> > > > > > > The whole idea behind the "handler"
> > function
> > > is
> > > > > that
> > > > > > > you are going to make
> > > > > > > the request yourself, instead of letting
> > > struts
> > > > > do
> > > > > > > it for you. The handler
> > > > > > > is just a plain javascript function like:
> > > > > > >
> > > > > > > function superHandler(widget, domNode) {
> > > > > > >   //use some other framework to do the
> > ajax
> > > > > request,
> > > > > > > Dojo, Prototype, YUI,
> > > > > > > DWR, JQuery,....zillion_framework_name
> > > > > > > }
> > > > > > >
> > > > > > > is that what you are trying to do? do the
> > > > > request
> > > > > > > yourself?
> > > > > > >
> > > > > > > musachy
> > > > > > >
> > > > > > > On 5/2/07, Scott Nesbitt
> > > > > <sc...@yahoo.com>
> > > > > > > wrote:
> > > > > > > >
> > > > > > > > Does anyone know how to invoke a request
> > > from
> > > > > a
> > > > > > > submit
> > > > > > > > handler function?
> > > > > > > >
> > > > > > > >
> > > > > > > > I am using a submit tag like this:
> > > > > > > >
> > > > > > > > <div id="t1">Div 1</div>
> > > > > > > > <s:url id="ajaxTest"
> > > value="SaveLineup.action"
> > > > > />
> > > > > > > > <img id="indicator"
> > > > > > > >      src="images/indicator.gif"
> > > > > > > >      alt="Loading..."
> > > > > > > >      style="display:none"/>
> > > > > > > > <s:submit type="submit"
> > > > > > > >           theme="ajax"
> > > > > > > >           value="Save"
> > > > > > > >           title="Save all changes."
> > > > > > > >           cssClass="butstylewide"
> > > > > > > >           targets="t1"
> > > > > > > >           handler="handler"
> > > > > > > >           notifyTopics="/after"
> > > > > > > >           href="%{ajaxTest}"
> > > > > > > >           align="left"
> > > > > > > >           indicator="indicator"/>
> > > > > > > >
> > > > > > > > My Javascript looks like this:
> > > > > > > >
> > > > > > > > function handler(widget, node)
> > > > > > > > {
> > > > > > > >    alert("DEBUG in handler");
> > > > > > > > }
> > > > > > > >
> > > > > > > > dojo.event.topic.subscribe("/after",
> > > > > > > function(data,
> > > > > > > > type, e)
> > > > > > > > {
> > > > > > > >    alert("Lineup saved");
> > > > > > > > });
> > > > > > > >
> > > > > > > > The documentation says this:
> > > > > > > >
> > > > > > > > 'handler' is the name of the function
> > that
> > > > > will
> > > > > > > take
> > > > > > > > care of making the AJAX request. Dojo's
> > > widget
> > > > > and
> > > > > > > dom
> > > > > > > > node are passed as parameters).
> > > > > > > >
> > > > > > > > But I do not see any example of how to
> > > > > actually do
> > > > > > > > that.  I guess it is some Dojo magic but
> > > > > looking
> > > > > > > > through the Dojo documentation has not
> > > proved
> > > > > > > > illuminating.  (BTW, I know if I do not
> > > have
> > > > > > > handler
> > > > > > > > specified it calls the action but I need
> > > to do
> > > > > > > some
> > > > > > > > JavaScript work beforehand.)
> > > > > > > >
> > > > > > > > Thanks,
> > > > > > > >
> > > > > > > > Scott
> > > > > > > >
> > > > > > > >
> > > > >
> > > __________________________________________________
> > > > > > > > Do You Yahoo!?
> >
> === message truncated ===
>
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com
>
> ---------------------------------------------------------------------
> 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

Re: S2: submit tag and handler

Posted by Scott Nesbitt <sc...@yahoo.com>.
Anybody have a suggestion on this?  Or do I just need
to wait until the next version of Struts?

Thanks,

Scott

--- Scott Nesbitt <sc...@yahoo.com> wrote:

> 
> Well, I tried this:
> 
> function handler(widget, node)
> {
>    var beforeTopicsArray =
> widget.beforeNotifyTopicsArray;
>    widget.beforeNotifyTopicsArray = null;
>    widget.reloadContents();
>    widget.beforeNotifyTopicsArray =
> beforeTopicsArray;
> }
> 
> and now I do not get a stack overflow, but the
> action
> is still not getting called.
> 
> Scott
> 
> --- Musachy Barroso <mu...@gmail.com> wrote:
> 
> > My bad, the notifyTopics are published inside that
> > function so it won't
> > work. Warning: Hack ahead :)
> > 
> > var beforeTopicsArray =
> > widget.beforeNotifyTopicsArray;
> > widget.beforeNotifyTopicsArray = null;
> > widget.reloadContents();
> > widget.beforeNotifyTopicsArray =
> beforeTopicsArray;
> > 
> > I will add a "refreshContent" method that will be
> > common for all of the
> > widgets (and part of the api), with one
> > parameter(boolean), to skip the
> > publishing of the topics.
> > 
> > musachy
> > 
> > On 5/2/07, Scott Nesbitt <sc...@yahoo.com>
> > wrote:
> > >
> > >
> > > Hmm, this:
> > >
> > > function handler(widget, node)
> > > {
> > >    widget.reloadContents();
> > > }
> > >
> > > Gives "Stack overflow at line: 4872"
> > >
> > > Scott
> > >
> > > --- Musachy Barroso <mu...@gmail.com> wrote:
> > >
> > > > If you are using submit, or anchor tag you can
> > call
> > > > "reloadContents()" on
> > > > the widget passed as a parameter, if you are
> > using
> > > > the div tag, you can call
> > > > "refresh()" on it. These functions are not
> > really
> > > > part of the api and might
> > > > change in the future (although it would be
> nice
> > if
> > > > they were right?).
> > > >
> > > > musachy
> > > >
> > > > On 5/2/07, Scott Nesbitt
> > <sc...@yahoo.com>
> > > > wrote:
> > > > >
> > > > >
> > > > > Yes, I would like to do the request in the
> > > > JavaScript
> > > > > because I need to do some other work there
> > before
> > > > the
> > > > > request happens.
> > > > >
> > > > > If I knew how Struts did the request I would
> > just
> > > > do
> > > > > the same thing at the bottom of my function.
> > > > >
> > > > > Scott
> > > > >
> > > > > --- Musachy Barroso <mu...@gmail.com>
> wrote:
> > > > >
> > > > > > The whole idea behind the "handler"
> function
> > is
> > > > that
> > > > > > you are going to make
> > > > > > the request yourself, instead of letting
> > struts
> > > > do
> > > > > > it for you. The handler
> > > > > > is just a plain javascript function like:
> > > > > >
> > > > > > function superHandler(widget, domNode) {
> > > > > >   //use some other framework to do the
> ajax
> > > > request,
> > > > > > Dojo, Prototype, YUI,
> > > > > > DWR, JQuery,....zillion_framework_name
> > > > > > }
> > > > > >
> > > > > > is that what you are trying to do? do the
> > > > request
> > > > > > yourself?
> > > > > >
> > > > > > musachy
> > > > > >
> > > > > > On 5/2/07, Scott Nesbitt
> > > > <sc...@yahoo.com>
> > > > > > wrote:
> > > > > > >
> > > > > > > Does anyone know how to invoke a request
> > from
> > > > a
> > > > > > submit
> > > > > > > handler function?
> > > > > > >
> > > > > > >
> > > > > > > I am using a submit tag like this:
> > > > > > >
> > > > > > > <div id="t1">Div 1</div>
> > > > > > > <s:url id="ajaxTest"
> > value="SaveLineup.action"
> > > > />
> > > > > > > <img id="indicator"
> > > > > > >      src="images/indicator.gif"
> > > > > > >      alt="Loading..."
> > > > > > >      style="display:none"/>
> > > > > > > <s:submit type="submit"
> > > > > > >           theme="ajax"
> > > > > > >           value="Save"
> > > > > > >           title="Save all changes."
> > > > > > >           cssClass="butstylewide"
> > > > > > >           targets="t1"
> > > > > > >           handler="handler"
> > > > > > >           notifyTopics="/after"
> > > > > > >           href="%{ajaxTest}"
> > > > > > >           align="left"
> > > > > > >           indicator="indicator"/>
> > > > > > >
> > > > > > > My Javascript looks like this:
> > > > > > >
> > > > > > > function handler(widget, node)
> > > > > > > {
> > > > > > >    alert("DEBUG in handler");
> > > > > > > }
> > > > > > >
> > > > > > > dojo.event.topic.subscribe("/after",
> > > > > > function(data,
> > > > > > > type, e)
> > > > > > > {
> > > > > > >    alert("Lineup saved");
> > > > > > > });
> > > > > > >
> > > > > > > The documentation says this:
> > > > > > >
> > > > > > > 'handler' is the name of the function
> that
> > > > will
> > > > > > take
> > > > > > > care of making the AJAX request. Dojo's
> > widget
> > > > and
> > > > > > dom
> > > > > > > node are passed as parameters).
> > > > > > >
> > > > > > > But I do not see any example of how to
> > > > actually do
> > > > > > > that.  I guess it is some Dojo magic but
> > > > looking
> > > > > > > through the Dojo documentation has not
> > proved
> > > > > > > illuminating.  (BTW, I know if I do not
> > have
> > > > > > handler
> > > > > > > specified it calls the action but I need
> > to do
> > > > > > some
> > > > > > > JavaScript work beforehand.)
> > > > > > >
> > > > > > > Thanks,
> > > > > > >
> > > > > > > Scott
> > > > > > >
> > > > > > >
> > > >
> > __________________________________________________
> > > > > > > Do You Yahoo!?
> 
=== message truncated ===


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

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


Re: S2: submit tag and handler

Posted by Scott Nesbitt <sc...@yahoo.com>.
Well, I tried this:

function handler(widget, node)
{
   var beforeTopicsArray =
widget.beforeNotifyTopicsArray;
   widget.beforeNotifyTopicsArray = null;
   widget.reloadContents();
   widget.beforeNotifyTopicsArray = beforeTopicsArray;
}

and now I do not get a stack overflow, but the action
is still not getting called.

Scott

--- Musachy Barroso <mu...@gmail.com> wrote:

> My bad, the notifyTopics are published inside that
> function so it won't
> work. Warning: Hack ahead :)
> 
> var beforeTopicsArray =
> widget.beforeNotifyTopicsArray;
> widget.beforeNotifyTopicsArray = null;
> widget.reloadContents();
> widget.beforeNotifyTopicsArray = beforeTopicsArray;
> 
> I will add a "refreshContent" method that will be
> common for all of the
> widgets (and part of the api), with one
> parameter(boolean), to skip the
> publishing of the topics.
> 
> musachy
> 
> On 5/2/07, Scott Nesbitt <sc...@yahoo.com>
> wrote:
> >
> >
> > Hmm, this:
> >
> > function handler(widget, node)
> > {
> >    widget.reloadContents();
> > }
> >
> > Gives "Stack overflow at line: 4872"
> >
> > Scott
> >
> > --- Musachy Barroso <mu...@gmail.com> wrote:
> >
> > > If you are using submit, or anchor tag you can
> call
> > > "reloadContents()" on
> > > the widget passed as a parameter, if you are
> using
> > > the div tag, you can call
> > > "refresh()" on it. These functions are not
> really
> > > part of the api and might
> > > change in the future (although it would be nice
> if
> > > they were right?).
> > >
> > > musachy
> > >
> > > On 5/2/07, Scott Nesbitt
> <sc...@yahoo.com>
> > > wrote:
> > > >
> > > >
> > > > Yes, I would like to do the request in the
> > > JavaScript
> > > > because I need to do some other work there
> before
> > > the
> > > > request happens.
> > > >
> > > > If I knew how Struts did the request I would
> just
> > > do
> > > > the same thing at the bottom of my function.
> > > >
> > > > Scott
> > > >
> > > > --- Musachy Barroso <mu...@gmail.com> wrote:
> > > >
> > > > > The whole idea behind the "handler" function
> is
> > > that
> > > > > you are going to make
> > > > > the request yourself, instead of letting
> struts
> > > do
> > > > > it for you. The handler
> > > > > is just a plain javascript function like:
> > > > >
> > > > > function superHandler(widget, domNode) {
> > > > >   //use some other framework to do the ajax
> > > request,
> > > > > Dojo, Prototype, YUI,
> > > > > DWR, JQuery,....zillion_framework_name
> > > > > }
> > > > >
> > > > > is that what you are trying to do? do the
> > > request
> > > > > yourself?
> > > > >
> > > > > musachy
> > > > >
> > > > > On 5/2/07, Scott Nesbitt
> > > <sc...@yahoo.com>
> > > > > wrote:
> > > > > >
> > > > > > Does anyone know how to invoke a request
> from
> > > a
> > > > > submit
> > > > > > handler function?
> > > > > >
> > > > > >
> > > > > > I am using a submit tag like this:
> > > > > >
> > > > > > <div id="t1">Div 1</div>
> > > > > > <s:url id="ajaxTest"
> value="SaveLineup.action"
> > > />
> > > > > > <img id="indicator"
> > > > > >      src="images/indicator.gif"
> > > > > >      alt="Loading..."
> > > > > >      style="display:none"/>
> > > > > > <s:submit type="submit"
> > > > > >           theme="ajax"
> > > > > >           value="Save"
> > > > > >           title="Save all changes."
> > > > > >           cssClass="butstylewide"
> > > > > >           targets="t1"
> > > > > >           handler="handler"
> > > > > >           notifyTopics="/after"
> > > > > >           href="%{ajaxTest}"
> > > > > >           align="left"
> > > > > >           indicator="indicator"/>
> > > > > >
> > > > > > My Javascript looks like this:
> > > > > >
> > > > > > function handler(widget, node)
> > > > > > {
> > > > > >    alert("DEBUG in handler");
> > > > > > }
> > > > > >
> > > > > > dojo.event.topic.subscribe("/after",
> > > > > function(data,
> > > > > > type, e)
> > > > > > {
> > > > > >    alert("Lineup saved");
> > > > > > });
> > > > > >
> > > > > > The documentation says this:
> > > > > >
> > > > > > 'handler' is the name of the function that
> > > will
> > > > > take
> > > > > > care of making the AJAX request. Dojo's
> widget
> > > and
> > > > > dom
> > > > > > node are passed as parameters).
> > > > > >
> > > > > > But I do not see any example of how to
> > > actually do
> > > > > > that.  I guess it is some Dojo magic but
> > > looking
> > > > > > through the Dojo documentation has not
> proved
> > > > > > illuminating.  (BTW, I know if I do not
> have
> > > > > handler
> > > > > > specified it calls the action but I need
> to do
> > > > > some
> > > > > > JavaScript work beforehand.)
> > > > > >
> > > > > > Thanks,
> > > > > >
> > > > > > Scott
> > > > > >
> > > > > >
> > >
> __________________________________________________
> > > > > > Do You Yahoo!?
> > > > > > Tired of spam?  Yahoo! Mail has the best
> spam
> > > > > protection around
> > > > > > http://mail.yahoo.com
> > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
>
---------------------------------------------------------------------
> > > > > > 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
> > > > >
> > > >
> > > >
> > > >
> __________________________________________________
> 
=== message truncated ===


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

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


Re: S2: submit tag and handler

Posted by Musachy Barroso <mu...@gmail.com>.
My bad, the notifyTopics are published inside that function so it won't
work. Warning: Hack ahead :)

var beforeTopicsArray = widget.beforeNotifyTopicsArray;
widget.beforeNotifyTopicsArray = null;
widget.reloadContents();
widget.beforeNotifyTopicsArray = beforeTopicsArray;

I will add a "refreshContent" method that will be common for all of the
widgets (and part of the api), with one parameter(boolean), to skip the
publishing of the topics.

musachy

On 5/2/07, Scott Nesbitt <sc...@yahoo.com> wrote:
>
>
> Hmm, this:
>
> function handler(widget, node)
> {
>    widget.reloadContents();
> }
>
> Gives "Stack overflow at line: 4872"
>
> Scott
>
> --- Musachy Barroso <mu...@gmail.com> wrote:
>
> > If you are using submit, or anchor tag you can call
> > "reloadContents()" on
> > the widget passed as a parameter, if you are using
> > the div tag, you can call
> > "refresh()" on it. These functions are not really
> > part of the api and might
> > change in the future (although it would be nice if
> > they were right?).
> >
> > musachy
> >
> > On 5/2/07, Scott Nesbitt <sc...@yahoo.com>
> > wrote:
> > >
> > >
> > > Yes, I would like to do the request in the
> > JavaScript
> > > because I need to do some other work there before
> > the
> > > request happens.
> > >
> > > If I knew how Struts did the request I would just
> > do
> > > the same thing at the bottom of my function.
> > >
> > > Scott
> > >
> > > --- Musachy Barroso <mu...@gmail.com> wrote:
> > >
> > > > The whole idea behind the "handler" function is
> > that
> > > > you are going to make
> > > > the request yourself, instead of letting struts
> > do
> > > > it for you. The handler
> > > > is just a plain javascript function like:
> > > >
> > > > function superHandler(widget, domNode) {
> > > >   //use some other framework to do the ajax
> > request,
> > > > Dojo, Prototype, YUI,
> > > > DWR, JQuery,....zillion_framework_name
> > > > }
> > > >
> > > > is that what you are trying to do? do the
> > request
> > > > yourself?
> > > >
> > > > musachy
> > > >
> > > > On 5/2/07, Scott Nesbitt
> > <sc...@yahoo.com>
> > > > wrote:
> > > > >
> > > > > Does anyone know how to invoke a request from
> > a
> > > > submit
> > > > > handler function?
> > > > >
> > > > >
> > > > > I am using a submit tag like this:
> > > > >
> > > > > <div id="t1">Div 1</div>
> > > > > <s:url id="ajaxTest" value="SaveLineup.action"
> > />
> > > > > <img id="indicator"
> > > > >      src="images/indicator.gif"
> > > > >      alt="Loading..."
> > > > >      style="display:none"/>
> > > > > <s:submit type="submit"
> > > > >           theme="ajax"
> > > > >           value="Save"
> > > > >           title="Save all changes."
> > > > >           cssClass="butstylewide"
> > > > >           targets="t1"
> > > > >           handler="handler"
> > > > >           notifyTopics="/after"
> > > > >           href="%{ajaxTest}"
> > > > >           align="left"
> > > > >           indicator="indicator"/>
> > > > >
> > > > > My Javascript looks like this:
> > > > >
> > > > > function handler(widget, node)
> > > > > {
> > > > >    alert("DEBUG in handler");
> > > > > }
> > > > >
> > > > > dojo.event.topic.subscribe("/after",
> > > > function(data,
> > > > > type, e)
> > > > > {
> > > > >    alert("Lineup saved");
> > > > > });
> > > > >
> > > > > The documentation says this:
> > > > >
> > > > > 'handler' is the name of the function that
> > will
> > > > take
> > > > > care of making the AJAX request. Dojo's widget
> > and
> > > > dom
> > > > > node are passed as parameters).
> > > > >
> > > > > But I do not see any example of how to
> > actually do
> > > > > that.  I guess it is some Dojo magic but
> > looking
> > > > > through the Dojo documentation has not proved
> > > > > illuminating.  (BTW, I know if I do not have
> > > > handler
> > > > > specified it calls the action but I need to do
> > > > some
> > > > > JavaScript work beforehand.)
> > > > >
> > > > > Thanks,
> > > > >
> > > > > Scott
> > > > >
> > > > >
> > __________________________________________________
> > > > > Do You Yahoo!?
> > > > > Tired of spam?  Yahoo! Mail has the best spam
> > > > protection around
> > > > > http://mail.yahoo.com
> > > > >
> > > > >
> > > >
> > >
> >
> ---------------------------------------------------------------------
> > > > > 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
> > > >
> > >
> > >
> > > __________________________________________________
> > > Do You Yahoo!?
> > > Tired of spam?  Yahoo! Mail has the best spam
> > protection around
> > > http://mail.yahoo.com
> > >
> > >
> >
> ---------------------------------------------------------------------
> > > 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
> >
>
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com
>
> ---------------------------------------------------------------------
> 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

Re: S2: submit tag and handler

Posted by Scott Nesbitt <sc...@yahoo.com>.
Hmm, this:

function handler(widget, node)
{
   widget.reloadContents();
}

Gives "Stack overflow at line: 4872"

Scott

--- Musachy Barroso <mu...@gmail.com> wrote:

> If you are using submit, or anchor tag you can call
> "reloadContents()" on
> the widget passed as a parameter, if you are using
> the div tag, you can call
> "refresh()" on it. These functions are not really
> part of the api and might
> change in the future (although it would be nice if
> they were right?).
> 
> musachy
> 
> On 5/2/07, Scott Nesbitt <sc...@yahoo.com>
> wrote:
> >
> >
> > Yes, I would like to do the request in the
> JavaScript
> > because I need to do some other work there before
> the
> > request happens.
> >
> > If I knew how Struts did the request I would just
> do
> > the same thing at the bottom of my function.
> >
> > Scott
> >
> > --- Musachy Barroso <mu...@gmail.com> wrote:
> >
> > > The whole idea behind the "handler" function is
> that
> > > you are going to make
> > > the request yourself, instead of letting struts
> do
> > > it for you. The handler
> > > is just a plain javascript function like:
> > >
> > > function superHandler(widget, domNode) {
> > >   //use some other framework to do the ajax
> request,
> > > Dojo, Prototype, YUI,
> > > DWR, JQuery,....zillion_framework_name
> > > }
> > >
> > > is that what you are trying to do? do the
> request
> > > yourself?
> > >
> > > musachy
> > >
> > > On 5/2/07, Scott Nesbitt
> <sc...@yahoo.com>
> > > wrote:
> > > >
> > > > Does anyone know how to invoke a request from
> a
> > > submit
> > > > handler function?
> > > >
> > > >
> > > > I am using a submit tag like this:
> > > >
> > > > <div id="t1">Div 1</div>
> > > > <s:url id="ajaxTest" value="SaveLineup.action"
> />
> > > > <img id="indicator"
> > > >      src="images/indicator.gif"
> > > >      alt="Loading..."
> > > >      style="display:none"/>
> > > > <s:submit type="submit"
> > > >           theme="ajax"
> > > >           value="Save"
> > > >           title="Save all changes."
> > > >           cssClass="butstylewide"
> > > >           targets="t1"
> > > >           handler="handler"
> > > >           notifyTopics="/after"
> > > >           href="%{ajaxTest}"
> > > >           align="left"
> > > >           indicator="indicator"/>
> > > >
> > > > My Javascript looks like this:
> > > >
> > > > function handler(widget, node)
> > > > {
> > > >    alert("DEBUG in handler");
> > > > }
> > > >
> > > > dojo.event.topic.subscribe("/after",
> > > function(data,
> > > > type, e)
> > > > {
> > > >    alert("Lineup saved");
> > > > });
> > > >
> > > > The documentation says this:
> > > >
> > > > 'handler' is the name of the function that
> will
> > > take
> > > > care of making the AJAX request. Dojo's widget
> and
> > > dom
> > > > node are passed as parameters).
> > > >
> > > > But I do not see any example of how to
> actually do
> > > > that.  I guess it is some Dojo magic but
> looking
> > > > through the Dojo documentation has not proved
> > > > illuminating.  (BTW, I know if I do not have
> > > handler
> > > > specified it calls the action but I need to do
> > > some
> > > > JavaScript work beforehand.)
> > > >
> > > > Thanks,
> > > >
> > > > Scott
> > > >
> > > >
> __________________________________________________
> > > > Do You Yahoo!?
> > > > Tired of spam?  Yahoo! Mail has the best spam
> > > protection around
> > > > http://mail.yahoo.com
> > > >
> > > >
> > >
> >
>
---------------------------------------------------------------------
> > > > 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
> > >
> >
> >
> > __________________________________________________
> > Do You Yahoo!?
> > Tired of spam?  Yahoo! Mail has the best spam
> protection around
> > http://mail.yahoo.com
> >
> >
>
---------------------------------------------------------------------
> > 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
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

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


Re: S2: submit tag and handler

Posted by Musachy Barroso <mu...@gmail.com>.
If you are using submit, or anchor tag you can call "reloadContents()" on
the widget passed as a parameter, if you are using the div tag, you can call
"refresh()" on it. These functions are not really part of the api and might
change in the future (although it would be nice if they were right?).

musachy

On 5/2/07, Scott Nesbitt <sc...@yahoo.com> wrote:
>
>
> Yes, I would like to do the request in the JavaScript
> because I need to do some other work there before the
> request happens.
>
> If I knew how Struts did the request I would just do
> the same thing at the bottom of my function.
>
> Scott
>
> --- Musachy Barroso <mu...@gmail.com> wrote:
>
> > The whole idea behind the "handler" function is that
> > you are going to make
> > the request yourself, instead of letting struts do
> > it for you. The handler
> > is just a plain javascript function like:
> >
> > function superHandler(widget, domNode) {
> >   //use some other framework to do the ajax request,
> > Dojo, Prototype, YUI,
> > DWR, JQuery,....zillion_framework_name
> > }
> >
> > is that what you are trying to do? do the request
> > yourself?
> >
> > musachy
> >
> > On 5/2/07, Scott Nesbitt <sc...@yahoo.com>
> > wrote:
> > >
> > > Does anyone know how to invoke a request from a
> > submit
> > > handler function?
> > >
> > >
> > > I am using a submit tag like this:
> > >
> > > <div id="t1">Div 1</div>
> > > <s:url id="ajaxTest" value="SaveLineup.action" />
> > > <img id="indicator"
> > >      src="images/indicator.gif"
> > >      alt="Loading..."
> > >      style="display:none"/>
> > > <s:submit type="submit"
> > >           theme="ajax"
> > >           value="Save"
> > >           title="Save all changes."
> > >           cssClass="butstylewide"
> > >           targets="t1"
> > >           handler="handler"
> > >           notifyTopics="/after"
> > >           href="%{ajaxTest}"
> > >           align="left"
> > >           indicator="indicator"/>
> > >
> > > My Javascript looks like this:
> > >
> > > function handler(widget, node)
> > > {
> > >    alert("DEBUG in handler");
> > > }
> > >
> > > dojo.event.topic.subscribe("/after",
> > function(data,
> > > type, e)
> > > {
> > >    alert("Lineup saved");
> > > });
> > >
> > > The documentation says this:
> > >
> > > 'handler' is the name of the function that will
> > take
> > > care of making the AJAX request. Dojo's widget and
> > dom
> > > node are passed as parameters).
> > >
> > > But I do not see any example of how to actually do
> > > that.  I guess it is some Dojo magic but looking
> > > through the Dojo documentation has not proved
> > > illuminating.  (BTW, I know if I do not have
> > handler
> > > specified it calls the action but I need to do
> > some
> > > JavaScript work beforehand.)
> > >
> > > Thanks,
> > >
> > > Scott
> > >
> > > __________________________________________________
> > > Do You Yahoo!?
> > > Tired of spam?  Yahoo! Mail has the best spam
> > protection around
> > > http://mail.yahoo.com
> > >
> > >
> >
> ---------------------------------------------------------------------
> > > 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
> >
>
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com
>
> ---------------------------------------------------------------------
> 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

Re: S2: submit tag and handler

Posted by Scott Nesbitt <sc...@yahoo.com>.
Yes, I would like to do the request in the JavaScript
because I need to do some other work there before the
request happens.

If I knew how Struts did the request I would just do
the same thing at the bottom of my function.

Scott

--- Musachy Barroso <mu...@gmail.com> wrote:

> The whole idea behind the "handler" function is that
> you are going to make
> the request yourself, instead of letting struts do
> it for you. The handler
> is just a plain javascript function like:
> 
> function superHandler(widget, domNode) {
>   //use some other framework to do the ajax request,
> Dojo, Prototype, YUI,
> DWR, JQuery,....zillion_framework_name
> }
> 
> is that what you are trying to do? do the request
> yourself?
> 
> musachy
> 
> On 5/2/07, Scott Nesbitt <sc...@yahoo.com>
> wrote:
> >
> > Does anyone know how to invoke a request from a
> submit
> > handler function?
> >
> >
> > I am using a submit tag like this:
> >
> > <div id="t1">Div 1</div>
> > <s:url id="ajaxTest" value="SaveLineup.action" />
> > <img id="indicator"
> >      src="images/indicator.gif"
> >      alt="Loading..."
> >      style="display:none"/>
> > <s:submit type="submit"
> >           theme="ajax"
> >           value="Save"
> >           title="Save all changes."
> >           cssClass="butstylewide"
> >           targets="t1"
> >           handler="handler"
> >           notifyTopics="/after"
> >           href="%{ajaxTest}"
> >           align="left"
> >           indicator="indicator"/>
> >
> > My Javascript looks like this:
> >
> > function handler(widget, node)
> > {
> >    alert("DEBUG in handler");
> > }
> >
> > dojo.event.topic.subscribe("/after",
> function(data,
> > type, e)
> > {
> >    alert("Lineup saved");
> > });
> >
> > The documentation says this:
> >
> > 'handler' is the name of the function that will
> take
> > care of making the AJAX request. Dojo's widget and
> dom
> > node are passed as parameters).
> >
> > But I do not see any example of how to actually do
> > that.  I guess it is some Dojo magic but looking
> > through the Dojo documentation has not proved
> > illuminating.  (BTW, I know if I do not have
> handler
> > specified it calls the action but I need to do
> some
> > JavaScript work beforehand.)
> >
> > Thanks,
> >
> > Scott
> >
> > __________________________________________________
> > Do You Yahoo!?
> > Tired of spam?  Yahoo! Mail has the best spam
> protection around
> > http://mail.yahoo.com
> >
> >
>
---------------------------------------------------------------------
> > 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
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

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


Re: S2: submit tag and handler

Posted by Musachy Barroso <mu...@gmail.com>.
The whole idea behind the "handler" function is that you are going to make
the request yourself, instead of letting struts do it for you. The handler
is just a plain javascript function like:

function superHandler(widget, domNode) {
  //use some other framework to do the ajax request, Dojo, Prototype, YUI,
DWR, JQuery,....zillion_framework_name
}

is that what you are trying to do? do the request yourself?

musachy

On 5/2/07, Scott Nesbitt <sc...@yahoo.com> wrote:
>
> Does anyone know how to invoke a request from a submit
> handler function?
>
>
> I am using a submit tag like this:
>
> <div id="t1">Div 1</div>
> <s:url id="ajaxTest" value="SaveLineup.action" />
> <img id="indicator"
>      src="images/indicator.gif"
>      alt="Loading..."
>      style="display:none"/>
> <s:submit type="submit"
>           theme="ajax"
>           value="Save"
>           title="Save all changes."
>           cssClass="butstylewide"
>           targets="t1"
>           handler="handler"
>           notifyTopics="/after"
>           href="%{ajaxTest}"
>           align="left"
>           indicator="indicator"/>
>
> My Javascript looks like this:
>
> function handler(widget, node)
> {
>    alert("DEBUG in handler");
> }
>
> dojo.event.topic.subscribe("/after", function(data,
> type, e)
> {
>    alert("Lineup saved");
> });
>
> The documentation says this:
>
> 'handler' is the name of the function that will take
> care of making the AJAX request. Dojo's widget and dom
> node are passed as parameters).
>
> But I do not see any example of how to actually do
> that.  I guess it is some Dojo magic but looking
> through the Dojo documentation has not proved
> illuminating.  (BTW, I know if I do not have handler
> specified it calls the action but I need to do some
> JavaScript work beforehand.)
>
> Thanks,
>
> Scott
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com
>
> ---------------------------------------------------------------------
> 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