Issue 254 in struts2-jquery: s:optiontransferselect and sj:submit

148 views
Skip to first unread message

struts2...@googlecode.com

unread,
Jul 23, 2010, 10:18:24 AM7/23/10
to struts2...@googlegroups.com
Status: New
Owner: ----
Labels: Type-Defect Priority-Medium

New issue 254 by camusg: s:optiontransferselect and sj:submit
http://code.google.com/p/struts2-jquery/issues/detail?id=254

What steps will reproduce the problem?
1. In a Struts Form (s:form), use the s:optiontransferselect.
2. Try to post your form with a sj:submit
3. Compare with s:submit

What is the expected output? What do you see instead?
Neither of param in s:optiontransferselect are posted in HTTP query with
sj:submit.
When using s:submit, you can see that some javascript code is added just
after submit button.

Javascript code added is like this (exported from struts 2 showcase) :
<script type="text/javascript">
var containingForm =
document.getElementById("lotsOfOptiontransferselectSubmit");
StrutsUtils.addEventListener(containingForm, "submit",
function(evt) {
var selectObj =
document.getElementById("lotsOfOptiontransferselectSubmit_favouriteCartoonCharacters");
selectAllOptionsExceptSome(selectObj, "key", "-1");
}, true);
StrutsUtils.addEventListener(containingForm, "submit",
function(evt) {
var selectObj =
document.getElementById("lotsOfOptiontransferselectSubmit_favouriteCars");
selectAllOptionsExceptSome(selectObj, "key", "");
}, true);
(...)
</script>


Which struts2 version?
2.1.8.1

Which struts2-jquery plugin version?
2.3.0


struts2...@googlecode.com

unread,
Jul 26, 2010, 4:52:00 PM7/26/10
to struts2...@googlegroups.com
Updates:
Status: Accepted
Owner: johgep
Labels: -Priority-Medium Priority-Low Component-Plugin

Comment #1 on issue 254 by johgep: s:optiontransferselect and sj:submit
http://code.google.com/p/struts2-jquery/issues/detail?id=254

can you provide a sample jsp? I have never worked with
s:optiontransferselect but currently I see no reason why it should not work.

struts2...@googlecode.com

unread,
Jul 28, 2010, 6:09:26 AM7/28/10
to struts2...@googlegroups.com

Comment #2 on issue 254 by camusg: s:optiontransferselect and sj:submit
http://code.google.com/p/struts2-jquery/issues/detail?id=254

Here an sample with jsp and action.
I work with your showcase (2.3.1 version).
You can put "pages.zip" in "pages" directory, and "action.zip"
in "com\jgeppert\struts2\jquery\showcase" directory.

I rewrite form.jsp to add my new link at the bottom of left menu.
In my page, I put two submit buttons, first from this plugin (sj:submit)
and second from struts 2 (s:submit).
Both result is displaying in your echo page.

I use Fiddler and Firebug to track all of parameters sent in HTTP request.
With sj:submit, the parameters are only, with this sample and default
values :
__multiselect_favouriteNames=&__multiselect_notFavouriteNames=

With s:submit, the parameters are :
favouriteNames=Patrick&favouriteNames=Jason&favouriteNames=Jay&favouriteNames=Toby&favouriteNames=Rene&__multiselect_favouriteNames=&notFavouriteNames=Robert&__multiselect_notFavouriteNames=

I think the problem is with a javascript function added (see my first
message) with Struts 2 Submit button, that is not added with Ajax Submit.

This sample is written with struts2-jquery plugin version 2.3.1.

Thank you for your great work and plugin !

Attachments:
action.zip 1.2 KB
pages.zip 2.6 KB

struts2...@googlecode.com

unread,
Aug 10, 2010, 8:45:45 AM8/10/10
to struts2...@googlegroups.com

Comment #3 on issue 254 by johgep: s:optiontransferselect and sj:submit
http://code.google.com/p/struts2-jquery/issues/detail?id=254

can you please try to put the onSubmit Events from Struts into an
onBeforeTopics?

<script type='text/javascript'>
jQuery(document).ready(function () {
$.subscribe('beforeSubmit', function(event, data) {
var selectObj = document.getElementById("<yourid>");
selectAllOptionsExceptSome(selectObj, "key", "");

var selectObj2 = document.getElementById("<yourdoubleid>");
selectAllOptionsExceptSome(selectObj2, "key", "");
});
});
</script>

<sj:submit ...
onBeforeTopics="beforeSubmit"
/>


struts2...@googlecode.com

unread,
Aug 10, 2010, 9:20:58 AM8/10/10
to struts2...@googlegroups.com

Comment #4 on issue 254 by camusg: s:optiontransferselect and sj:submit
http://code.google.com/p/struts2-jquery/issues/detail?id=254

I tried with your code, but I notice that all options are selected after
POST HTTP. If a push submit button a second time, that's work. But it
doesn't work the first time.

To solve this problem, we have to add manually some javascript code ? or
the code will be added by taglib ?
With struts submit button, code added automatically... It's possible to
extend this behavior with this plugin ?

Thanks for your work !

struts2...@googlecode.com

unread,
Aug 10, 2010, 10:32:27 AM8/10/10
to struts2...@googlegroups.com

Comment #5 on issue 254 by johgep: s:optiontransferselect and sj:submit
http://code.google.com/p/struts2-jquery/issues/detail?id=254

the problem is that the optiontransferselect element uses some javascript
which is registered to th onsubmit event of the form.

this events can't fired by code only by user interaction.

the next problem is that this scripts provided by struts only select all
items so the values are correctly submitted. but it does not deselect them
after submit.

currently i don't have a short solution for this.

struts2...@googlecode.com

unread,
Aug 24, 2010, 4:24:50 PM8/24/10
to struts2...@googlegroups.com

Comment #6 on issue 254 by hollandmatt: s:optiontransferselect and sj:submit
http://code.google.com/p/struts2-jquery/issues/detail?id=254

We are seeing the same problem, but only when using Chrome. Firefox and IE
work fine. I'm using Chrome 6 on Linux, Firefox 3.8 on Linux and IE8 on XP.

struts2...@googlecode.com

unread,
Aug 25, 2010, 3:27:17 AM8/25/10
to struts2...@googlegroups.com
Updates:
Status: WontFix

Comment #7 on issue 254 by johgep: s:optiontransferselect and sj:submit
http://code.google.com/p/struts2-jquery/issues/detail?id=254

this is struts2 javascript which work not well with this plugin.

just add an onBeforeTopics which select all entries in your option transfer
ans add an onCompleteTopics which deselect them after request is finished.

if anyone can provide a better solution I will reopen this Issue.

struts2...@googlecode.com

unread,
Aug 22, 2012, 11:09:26 AM8/22/12
to struts2...@googlegroups.com

Comment #8 on issue 254 by lrandria...@gmail.com: s:optiontransferselect
hi,
someone can help me please?
my problem is that I can not retrieve the value in the second list
thanks in advance

in my jsp:
<s:optiontransferselect
name="othersRoles"
list="listOtherRoles"
listKey="key"
listValue="value"
size="5"
cssStyle="width: 15em;"
doubleList="listOwnedRoles"
doubleListKey="key"
doubleListValue="value"
doubleName="ownedRoles"
doubleSize="5"
doubleCssStyle="width: 15em;"
allowUpDownOnLeft="false"
allowUpDownOnRight="false"
allowAddAllToLeft="false"
allowAddAllToRight="false"
allowSelectAll="false"
/>
java:
private List<KeyValue> listOwnedRoles = new ArrayList<KeyValue>();
private List<KeyValue> listOtherRoles = new ArrayList<KeyValue>();
public List<KeyValue> getListOwnedRoles() {
return listOwnedRoles;
}
public void setListOwnedRoles(List<KeyValue> listOwnedRoles) {
this.listOwnedRoles = listOwnedRoles;
}
public List<KeyValue> getListOtherRoles() {
return listOtherRoles;
}

public void setListOtherRoles(List<KeyValue> listOtherRoles) {
this.listOtherRoles = listOtherRoles;
}
public User loadDataFromAction() {
setListOwnedRoles(listOwnedRoles );
setListOtherRoles(listOtherRoles);
}


struts2...@googlecode.com

unread,
Sep 17, 2014, 3:26:28 AM9/17/14
to struts2...@googlegroups.com

Comment #9 on issue 254 by alberto....@tecsidel.es: s:optiontransferselect
and sj:submit
https://code.google.com/p/struts2-jquery/issues/detail?id=254

I have the same problem, I have tried to add an event to select all items
but it doesn´t work.

Does anybody know how to solve it?

Thanks


--
You received this message because this project is configured to send all
issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings

struts2...@googlecode.com

unread,
Dec 6, 2014, 3:57:19 AM12/6/14
to struts2...@googlegroups.com

Comment #10 on issue 254 by danielan...@gmail.com: s:optiontransferselect
I am experiencing same issue and I noticed it started when I included the
id attribute of the <s:form tag, without the id attribute of the form the
are sent a as optiontransferselect values are sent as comma separated
string. But without d id attribute submit opens new window looking dor a
workaround

struts2...@googlecode.com

unread,
Dec 6, 2014, 4:02:49 AM12/6/14
to struts2...@googlegroups.com

Comment #11 on issue 254 by danielan...@gmail.com: s:optiontransferselect
and sj:submit
https://code.google.com/p/struts2-jquery/issues/detail?id=254

I am experiencing same issue and I noticed it started when I included the
id attribute of the <s:form tag, without the id attribute of the form the
values of the optiontransferselect are sent as comma separated string. But
Reply all
Reply to author
Forward
0 new messages