How can we use Dojo tags to accomplish the same?
I tried using JQuery for the same.I could use it with html tags and it was working but not with struts 2 tags.
Any tutorials available???
Please guide me!!!
This seems to be a simple problem to me. In the show_detail method, you can call document.getElementById('Register:Workselect').selectedIndex (you can also use document.getElementById('Register:Workselect').options with it) to find out which element is selected. Then depending upon that you can make the divs visible or hidden using document.getElementById('box').style.display = 'none' or 'block'.
(As far as I remember, struts ads the form name to the id of form fields in the form but I don't remember if struts uses : between them or something else)
I don't think it's valid HTML to have a DIV nested in a FORM (that may depend on which version of HTML you're targeting, though).
It's actually a bit problematic to access the table row of a form element and its label at the moment. That may have been (at least partially) addressed in the "css_xhtml" theme, and I'm planning on adding it to the "xhtml" theme (and "css_xhtml" if it's not already there) but haven't had a chance.
Your quickest solution might be to just take whichever theme you're using and modify it to include suitable "id" attributes on the table rows (or DIV elements if you're using "css_xhtml"), or wait for the next release (I think I missed 2.1.7).
If you're using the default "xhtml" theme then using S2 form input elements without the <s:form> tag will produce *completely* invalid HTML, whereas embedding the div tags inside the table is invalid but might work.
Without knowing what theme you're using it's impossible to tell you much more than that.
I have a struts form, depending on the select option the div should show/hide and the div contains textfields. Am using jquery for show/hide div. The textfields within div are not behaving right. When I keep the theme as "simple", The textfields hide and on option selection they show up but the label to the textfield does not show up and the alignment is bad. If the Theme is "ajax" or "qxhtml" or "xhtml", the textfields hide/show properly but the labels of textfields do not hide. Is there a good compromise between the layout and the hide/show functionality?