Kiran Kongala
2018-07-14 11:01:37 UTC
Hi Guys,
We are using Struts 2.5.13 in our Enterprise Java Application and one of
the jsp page has many Struts Select tags with multiple=true(s:select
multiple=true) .
I know that for selecting/deselecting multiple items in the list, we have
to hold the Ctrl Key.
But for the Users who are using our application, they have an issue.
Suppose the User selected 5 items out of 20 in a multi select drop down by
holding Ctrl Key and saved the page in the Add flow.
In the Edit flow, the User wants to select 6th item in the existing multi
select drop down and if the user forgets to hold the Ctrl key while
selecting the 6th item, then all the other 5 items are deselected and only
the 6th item is selected.
Without even realizing that they deselected the other items in the list
they save the page. By mistake they don't want that to happen.
So they asked is there a way to work with the multi select by
selecting/desecting multiple items in the list without holding the Ctrl Key
or to stop this happening with the Select tag.
So we added the below jquery script so that they can select/deselect
without holding the Ctrl Key.
jQuery('option').mousedown(function(e) {
e.preventDefault();
var selector = this.parentElement.id;
jQuery(this).prop('selected', !jQuery(this).prop('selected'));
jQuery('#' + selector).trigger('change');
return false;
});
But this script only works in Chrome and may be FF but it doesn't work in
IE.
Because most of our Users uses the IE as the default browser and most of
the application is tested on IE only, Is there any work around with this
problem or is there any property in the S:SELECT which will solve this
issue?
Please help.
Thanks
We are using Struts 2.5.13 in our Enterprise Java Application and one of
the jsp page has many Struts Select tags with multiple=true(s:select
multiple=true) .
I know that for selecting/deselecting multiple items in the list, we have
to hold the Ctrl Key.
But for the Users who are using our application, they have an issue.
Suppose the User selected 5 items out of 20 in a multi select drop down by
holding Ctrl Key and saved the page in the Add flow.
In the Edit flow, the User wants to select 6th item in the existing multi
select drop down and if the user forgets to hold the Ctrl key while
selecting the 6th item, then all the other 5 items are deselected and only
the 6th item is selected.
Without even realizing that they deselected the other items in the list
they save the page. By mistake they don't want that to happen.
So they asked is there a way to work with the multi select by
selecting/desecting multiple items in the list without holding the Ctrl Key
or to stop this happening with the Select tag.
So we added the below jquery script so that they can select/deselect
without holding the Ctrl Key.
jQuery('option').mousedown(function(e) {
e.preventDefault();
var selector = this.parentElement.id;
jQuery(this).prop('selected', !jQuery(this).prop('selected'));
jQuery('#' + selector).trigger('change');
return false;
});
But this script only works in Chrome and may be FF but it doesn't work in
IE.
Because most of our Users uses the IE as the default browser and most of
the application is tested on IE only, Is there any work around with this
problem or is there any property in the S:SELECT which will solve this
issue?
Please help.
Thanks