You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Dave Newton <ne...@yahoo.com> on 2007/04/03 20:30:16 UTC
[S2] Form submission/update question...
I have an <s:tabbedPanel.../> with Ajax <s:div.../>s
with forms.
One of the divs is a form with a file upload and an
Ajax <s:div.../> with a list of files (it has some
ordering functionality I wanted to separate out; it
will be an Ajax form at some point).
What I'd *like* to do is update just the list of files
in the <s:div.../> (in the one tab) after a successful
file upload.
So far I haven't figured out the magic combination
that lets me do that :/
Anybody have any hints or clues?
TIA,
Dave
____________________________________________________________________________________
We won't tell. Get more on shows you hate to love
(and love to hate): Yahoo! TV's Guilty Pleasures list.
http://tv.yahoo.com/collections/265
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: [S2] Form submission/update question...
Posted by Dave Newton <ne...@yahoo.com>.
--- Musachy Barroso <mu...@gmail.com> wrote:
> [... all the info I need ...]
You rule!
I might update some of those docs, though; even after
reading it again it left me puzzled (will probably
just put an edited version of your reply).
Thanks, and thanks for looking into that <s:div.../>
href thing.
d.
____________________________________________________________________________________
Don't pick lemons.
See all the new 2007 cars at Yahoo! Autos.
http://autos.yahoo.com/new_cars.html
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: [S2] Form submission/update question...
Posted by Musachy Barroso <mu...@gmail.com>.
You can either set theme="ajax" on the submit, or on the form, and add a
"notifyTopic" to the submit tag. Topics there will be executed twice, one
before and one after the request, it is documented on the ajax page. The
topic receives 3 parameters and one of them is an string which will be
"before" for the before-request-callback, and "load" for the
after-request-callbak. On 2.1 I added a beforeNotifyTopic, and
afterNotifyTopic to simplify this.
On 2.0.X you will have to do something like:
dojo.event.topic.subscribe("/request", function(data, type, request) {
if(type == "load") {
//reload your div
dojo.topic.publish("/refresh")
}
});
<s:url
id="ajaxTest"
value="/AjaxTest.action" />
<s:submit
type="submit"
theme="ajax"
value="submit"
notifyTopics="/request"
href="%{ajaxTest}"/>
musachy
On 4/3/07, Dave Newton <ne...@yahoo.com> wrote:
>
> --- Dave Newton <ne...@yahoo.com> wrote:
> > This is actually "working" except that the
> > fileListDiv updates with:
>
> Minor update:
>
> ...
> <s:submit notifyTopics="/updateFileList"/>
>
> ...
> <s:div href="%{...}"
> listenTopics="/updateFileList".../>
>
> almost works but the div updates itself twice; once
> immediately and once again after the form submission
> completes (I assume).
>
> d.
>
>
>
>
>
> ____________________________________________________________________________________
> 8:00? 8:25? 8:40? Find a flick in no time
> with the Yahoo! Search movie showtime shortcut.
> http://tools.search.yahoo.com/shortcuts/#news
>
> ---------------------------------------------------------------------
> 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] Form submission/update question...
Posted by Dave Newton <ne...@yahoo.com>.
--- Dave Newton <ne...@yahoo.com> wrote:
> This is actually "working" except that the
> fileListDiv updates with:
Minor update:
...
<s:submit notifyTopics="/updateFileList"/>
...
<s:div href="%{...}"
listenTopics="/updateFileList".../>
almost works but the div updates itself twice; once
immediately and once again after the form submission
completes (I assume).
d.
____________________________________________________________________________________
8:00? 8:25? 8:40? Find a flick in no time
with the Yahoo! Search movie showtime shortcut.
http://tools.search.yahoo.com/shortcuts/#news
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: [S2] Form submission/update question...
Posted by Dave Newton <ne...@yahoo.com>.
--- Ian Roughley <ia...@fdar.com> wrote:
> You could try triggering an event topic on the
> result page of the form submission, then listening
> for that topic in the s:div ajax tag and reload
> the list of files.
I'm sorry to be dense, but how would that actually
work? Once I return a result from the form submission
aren't I moving off the page? Or are you suggesting I
can upload with an Ajax <s:form.../>?
(Hmm, I guess I can; I thought I had tried that
earlier and it had failed, but that was before I put
that ActionContextCleanUp filter in which I still
think may be necessary for reliable file upload.)
<s:form action="dynaList!addFile" method="post"
enctype="multipart/form-data" theme="ajax">
<s:file name="newFile" label="Add File"/>
<s:textfield name="newCaption" label="Caption"/>
<s:submit targets="fileListDiv"/>
</s:form>
<s:url action="dynaFileAction" id="fileListUrl"/>
<s:div id="fileListDiv"
href="%{fileListUrl}"
theme="ajax"
executeScripts="true">
Loading...
</s:div>
This is actually "working" except that the fileListDiv
updates with:
[object HTMLDocument]
which is... close-ish :/
I suspect either way I'm close, but I need another
hint.
Thanks!
d.
____________________________________________________________________________________
TV dinner still cooling?
Check out "Tonight's Picks" on Yahoo! TV.
http://tv.yahoo.com/
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: [S2] Form submission/update question...
Posted by Ian Roughley <ia...@fdar.com>.
You could try triggering an event topic on the result page of the form
submission, then listening for that topic in the s:div ajax tag and
reload the list of files. I know it would work in WW, haven't looked at
the ajax tags since the upgrade to the newest dojo version.
/Ian
Dave Newton wrote:
> I have an <s:tabbedPanel.../> with Ajax <s:div.../>s
> with forms.
>
> One of the divs is a form with a file upload and an
> Ajax <s:div.../> with a list of files (it has some
> ordering functionality I wanted to separate out; it
> will be an Ajax form at some point).
>
> What I'd *like* to do is update just the list of files
> in the <s:div.../> (in the one tab) after a successful
> file upload.
>
> So far I haven't figured out the magic combination
> that lets me do that :/
>
> Anybody have any hints or clues?
>
> TIA,
> Dave
>
>
>
>
> ____________________________________________________________________________________
> We won't tell. Get more on shows you hate to love
> (and love to hate): Yahoo! TV's Guilty Pleasures list.
> http://tv.yahoo.com/collections/265
>
> ---------------------------------------------------------------------
> 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