struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From RogerV <roger.var...@googlemail.com>
Subject OptionTransferSelect problem
Date Mon, 03 Jan 2011 15:01:11 GMT

Hi 

I'm trying to use the <s:optionTransferSelect> tag in Struts 2.2.1. The
documentation at
http://struts.apache.org/2.2.1/docs/optiontransferselect.html says that the
component will "Will auto-select all its elements upon its containing form
submision." but it's not doing that - I have to manually select the items in
the right hand list to get the values returned when the containing form is
submitted. I've listed the relevant jsp below and can confirm that the lists
are being populated correctly and I can move items from one list to another
without problems. Am I missing an attribute setting?

Regards

s:form id="simpleForm">
<s:optiontransferselect
     name="component"
     leftTitle="Available"
     rightTitle="Selected"
     list="available"
     multiple="true"
     emptyOption="true"
     doubleList="selected"
     doubleName="selectedName"
     doubleEmptyOption="true"
     doubleMultiple="true"
 />
 <s:submit type="button"/>
</s:form>

and the resulting generated HTML is;

<form id="simpleForm" name="simpleForm"
action="/GenesisNg-Web/admin/maintain-authorities.action" method="post">
<table class="wwFormTable">
<tr>
    <td class="tdLabel"></td>
    <td
>	<script type="text/javascript"
src="/GenesisNg-Web/struts/optiontransferselect.js"></script>
<table border="0">
<tr>
<td>
	<label for="leftTitle">Available</label><br />
<select name="component" size="15" id="simpleForm_component"
multiple="multiple">
    <option value=""></option>
    <option value="ROLE_UBER">ROLE_UBER</option>
    <option value="ROLE_ADMIN">ROLE_ADMIN</option>
    <option value="ROLE_TESTER">ROLE_TESTER</option>
    <option value="ROLE_SELECT_VCI">ROLE_SELECT_VCI</option>


</select>
<input type="hidden" id="__multiselect_simpleForm_component"
name="__multiselect_component" value="" />
<input type="button"
	onclick="moveOptionDown(document.getElementById('simpleForm_component'),
'key', '');"
	value="v"
/>
<input type="button"
	onclick="moveOptionUp(document.getElementById('simpleForm_component'),
'key', '');"
	value="^"
/>

</td>
<td valign="middle" align="center">
			<input type="button"
			 value="&lt;-"
onclick="moveSelectedOptions(document.getElementById('simpleForm_selectedName'),
document.getElementById('simpleForm_component'), false, '');" /><br /><br />
			<input type="button"
			 value="-&gt;"
onclick="moveSelectedOptions(document.getElementById('simpleForm_component'),
document.getElementById('simpleForm_selectedName'), false, '');" /><br /><br
/>
			<input type="button"
			 value="&lt;&lt;--"
onclick="moveAllOptions(document.getElementById('simpleForm_selectedName'),
document.getElementById('simpleForm_component'), false, '');" /><br /><br />
			<input type="button"
			 value="--&gt;&gt;"
onclick="moveAllOptions(document.getElementById('simpleForm_component'),
document.getElementById('simpleForm_selectedName'), false, '');" /><br /><br
/>
			<input type="button"
			 value="&lt;*&gt;"
onclick="selectAllOptions(document.getElementById('simpleForm_component'));selectAllOptions(document.getElementById('simpleForm_selectedName'));"
/><br /><br />
</td>
<td>
	<label for="rightTitle">Selected</label><br />
<select
	name="selectedName"
	size="15"
	multiple="multiple"
	id="simpleForm_selectedName"
>
    <option value=""></option>
    	<option value="ROLE_USER">ROLE_USER</option>
</select>
<input type="hidden" id="__multiselect_simpleForm_selectedName"
name="__multiselect_selectedName" value="" />
<input type="button"
	onclick="moveOptionDown(document.getElementById('simpleForm_selectedName'),
'key', '');"
	value="v"
/>
<input type="button"
	onclick="moveOptionUp(document.getElementById('simpleForm_selectedName'),
'key', '');"
	value="^"
/>
</td>
</tr>
</table>
</td>
</tr>


 <tr>
    <td colspan="2"><div align="right"><button type="submit"
id="simpleForm_0" value="Submit">
Submit
</button>
</div></td>
</tr>

</table></form>

<script type="text/javascript">
	var containingForm = document.getElementById("simpleForm");
		StrutsUtils.addEventListener(containingForm, "submit", 
			function(evt) {
				var selectObj = document.getElementById("simpleForm_component");
					selectAllOptionsExceptSome(selectObj, "key", "");
			}, true);
	var containingForm = document.getElementById("simpleForm");
		StrutsUtils.addEventListener(containingForm, "submit", 
			function(evt) {
				var selectObj = document.getElementById("simpleForm_selectedName");
					selectAllOptionsExceptSome(selectObj, "key", "");
			}, true);


</script>


-- 
View this message in context: http://old.nabble.com/OptionTransferSelect-problem-tp30578624p30578624.html
Sent from the Struts - User mailing list archive at Nabble.com.


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


Mime
View raw message