Thank you very much! It works!
Manu Mahajan escribió:
Hi
If you want to handle the before and after topics separately you can do
something like this. Note I am publishing a separate topic for the form
(submitForm) and then handling it using some javascript code
<s:div id="treeAndSelector" theme="ajax" href="${refreshTreeUrl}"
listenTopics="/refreshTree" executeScripts="true"
loadingText=" "/>
<s:form ...>
...
<s:submit type="button" notifyTopics="/submitForm"
targets="workspaceAjaxContent" executeScripts="true"
loadingText=" " cssClass="submit">
<s:param name="value">
<fmt:message key="Buttons.accept"/>
</s:param>
</s:submit>
</s:form>
<script type="text/javascript">
dojo.event.topic.subscribe("/submitForm", function(data, type, e){
if (type=="before"){
//do something before the form is submitted
}
if (type=="load")
{
//do something after the form is submitted
//you can publish the refreshTree topic here
dojo.event.topic.publish("/refreshTree");
}
});
</script>
Now your tree will only be refreshed once...
Manu
-----Original Message-----
From: Pablo Vázquez Blázquez [mailto:[EMAIL PROTECTED]
Sent: Thursday, September 27, 2007 5:38 PM
To: Struts Users Mailing List
Subject: listen/notify Topics doubt
Hi all!
I have a simple question:
When a div tag contains the "listenTopics" attribute, the associated
href is executed *Before and After* the action associated to the tag
which invokes the notifyTopics??
<s:div id="treeAndSelector" theme="ajax" href="${refreshTreeUrl}"
listenTopics="/refreshTree" executeScripts="true"
loadingText=" "/>
<s:form ...>
...
<s:submit type="button" notifyTopics="/refreshTree"
targets="workspaceAjaxContent" executeScripts="true"
loadingText=" " cssClass="submit">
<s:param name="value">
<fmt:message key="Buttons.accept"/>
</s:param>
</s:submit>
</s:form>
When I submit the form it invokes the action form and i have 2 threads
invoking "refreshTreeUrl"... I would like to first invoke the action
form, and then, notifyTopics. Is it possible??
Thanks.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]