struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alejandro <apar...@gmail.com>
Subject Re: optiontransferselect don't use hidden input.
Date Tue, 31 May 2011 16:35:22 GMT
Hi Roger,

My Action file  is large!, i cut it:
...
private List<Integer> __multiselect_tiposEntornoAsignados;
....
public void set__multiselect_tiposEntornoAsignados(
List<Integer> __multiselect_tiposEntornoAsignados) {
System.out.println("Establece " +__multiselect_tiposEntornoAsignados);
this.__multiselect_tiposEntornoAsignados =
__multiselect_tiposEntornoAsignados;
}

public List<Integer> get__multiselect_tiposEntornoAsignados() {
return __multiselect_tiposEntornoAsignados;
}

<s:head> is used by the jsp file.
And JSP code for the tag:
....
<s:optiontransferselect name="tiposEntorno"
list="tiposEntorno"
doubleName="tiposEntornoAsignados"
doubleList="tiposEntornoAsignados"
doubleId="tiposEntornoListAsignados"
allowAddAllToLeft="false"
allowAddAllToRight="false"
allowSelectAll="false"
allowUpDownOnLeft="false"
allowUpDownOnRight="false"
doubleMultiple="true"
doubleSize="10"
size="10" />
....
Well, __multiselect_* is the name input hidden field. When send the values
doesn't call the set method, is it disabled?And when change the values for
double select not set values.  I changed the code html adding onchange
attribute to input tag and javscript code. I saw the code from struts and
not saw the use of this field.

I have fixed this :

Action-
private List<Integer> tiposTopografiaAsignados;
public void setTiposTopografiaAsignados(List<Integer>
tiposTopografiaAsignados) {
this.tiposTopografiaAsignados = tiposTopografiaAsignados;
}

public List<Integer> getTiposTopografiaAsignados() {
return tiposTopografiaAsignados;
}
Where tiposTopografiaAsignados is the name attribute for the double select.
JSP+Javscript
....
<script type="text/javascript">
 function selectAllByName(name) {
obj = document.getElementById(name);
if(obj != null) {
selectAllOptions(obj);
}
}
function click_submit() {
selectAllByName('tiposEntornoListAsignados');
}
</script>

   <sj:submit  targets="message_error"
        value="Guardar"
        button="true"
        onclick="click_submit()"
        /> // Yeah!,  I am using JQuery plugin for Struts 2 :D
.....

 am i using it wrong? would another fix be possible?

Thanks a lots.
2011/5/31 Roger Varley <roger.varley@googlemail.com>

> On Tue, 2011-05-31 at 13:44 +0200, Alejandro wrote:
> > Hi all,
> >
> > With optiontransferselect, I am trying to get the list of double list but
> it
> > is impossible if you dont select all  them.
> >
> > I had seen an input hidden with __multiselect_ but it isn't filled
> > properly.
> >
> > Thanks for all!
>
> Can you post your .jsp and backing action please. In the mean time,
> check that you have included the <s:head> tag in your page. This drags
> in a small javascript file which the optiontransferselect tag needs to
> work properly
>
> Regards
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message