i'm guessing that this is a pretty common problem but i couldn't find
any examples on the struts2 docs, i would like to know how best to go
about doing a popup/overlay form using struts2 + ajax.
so for example, if the user is on a page and clicks a link like "add
category" that link would popup/overlay a simple form on top of the
existing page and allow the user to enter in the necessary information
and submit it. the submit would happen asynchronously and after the
form is successfully submitted the overlay would close and an element on
the underlying page would be refreshed to contain the new data.
what i have so far is an ajax enabled div and an ajax enable anchor
which can pull the form ...
<s:a theme="ajax" href="%{addCategoryUrl}"
targets="addCategoryFormDiv">Add Category</s:a>
<s:div theme="ajax" href="%{listCategoriesUrl}"
listenTopics="/refreshCats" />
<div id="addCategoryFormDiv"></div>
so with these elements I can have my categories listed on a page using
my s:div and if I publish a "/refreshCats" event then that div
refreshes. then if my s:a link is clicked it will use the response to
display in the specified div below my category list, but that's as far
as i have been able to get.
what i don't fully understand is how to ...
1. get the form to be an overlay instead of just showing up on the page.
does dojo/struts2 have built-in support for this somehow?
2. how to properly setup the form so that when the user submits it to
add a new category that it closes the overlay form and publishes a
"/refreshCats" event.
This is how I have defined the form which gets asynchronously loaded
when the "Add Category" link is clicked ...
<s:form action="categoryAdd" theme="ajax">
<s:textfield name="newCatName" />
<s:submit type="button" />
</s:form>
i can then submit the form and have the category get added, but i don't
fully understand how to properly cause the form to close and then how to
publish the "/refreshCats" event.
can anyone offer some advice or examples on how to accomplish what i am
trying to do? i am happy to take my working code and put it together
into an example on the struts2 documentation as well.
-- Allen
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]