I am populating the values in double select box dynamically from database at the time of loading.
I am successful in getting the values for the first select box but I am not getting the respective values for second select box.
Please if any body can help me to get the values in the second select I am really in need.
I am using the MAP collection.
<s:doubleselect label="Control"
name="controlNameValue" list="control.keySet()"
doubleName="controlAreaValue" doubleList="control.get(top)" />
use moveSelectedOptions(... ..) on addToLeftOnClick and addToRightOnClick buttons.
Related
I have a page that is a report from a database and I'm working on modifying how the filtering works. The intention is to allow the user to select possible values form a list that will be used to filter the resulting report. There are too many values to do this with checkboxes. I'm defining a multiple selection list box with this:
<g:select name="country" from="${countryDataList.KOUNTRY}" value="${params.country}" multiple="true" />
countryDataList is a List<> of objects with a name and a value which I create in the controller. I'm able to get the selected counties and process them without an issue.
But when the page returns from the controller with the filtered report, only the first selection in the list is selected. It doesn't re-select all of the items that the user selected. I am passing the params.country object back from the controller as
country:params.country
I saw some posts about this not working, but they are all from several years ago. Am I missing a vital step?
Ahh sorry, I was reading it on the phone initially and missed the point.
So what you want is a way of sending a multiple select box to a confirmation page. If I understand correctly?
Anyways how many objects in the select are we talking massive or a dozen couple of dozen or so ?
What I did was use check boxes and did a confirmation which shows the selection ticked in check boxes.. So this is the confirmation page that loads in https://github.com/vahidhedayati/mailinglist/blob/master/grails-app/views/mailingListEmail/confirmcontact.gsp
this page which is where multiple attachments selected from the schedule re-appear...
https://github.com/vahidhedayati/mailinglist/blob/master/grails-app/views/mailingListAttachments/_mailerAttachmentsDisplay.gsp.
Please note advice below is all conceptual stuff and there may be easier ways than this
Other than that You could create a taglib call on the confirmation page https://github.com/vahidhedayati/ajaxdependancyselection/blob/master/grails-app/taglib/ajaxdependancyselection/AutoCompleteTagLib.groovy#L55 which takes in your arrayList you could probably convert it to JSON pass it into the javascript that you load in within the taglib (on mine further down it loads this page in)
https://github.com/vahidhedayati/ajaxdependancyselection/blob/master/grails-app/views/autoComplete/_selectJs1.gsp#L23
and look to reselect them using javascript... as I say I haven't tested the last bit, the first bit i.e. checkbox works it is/has been in use.
Years later from you I just had the same problem. What I figured out is: it happens when params.country is an array instead of a Collection (i.e. an ArrayList).
A workaround for this if you want to stick to the array type is at the value attribute of the tag doing this: params.country?.findAll().
i have 2 <g:select> elements in my gsp and both allow multiple selection (listboxes). I wrote some javascript that adds the option clicked by the user to the other select.
I build an array of items in select2.
I also have a form, that consist of checkboxes and such and submit button.
My problem is that I need to send that javascript array along other form data ( when i press submit ), to the controller. I just can't figure out a way, to send it.
Select box will get serialized and send with other form components, if you set every option to "selected = true".
New to Struts2.
I have a search criteria form(search1) ,where I have dropdown lists to submit to get a result page (consolidatedreports.jsp).
In my result page, I am showing the data from the search criteria, but I also have a form at the top of the results page with search2 criteria to submit again.
I am chaining my actions because the heading for the results page needs a value from the search1 criteria to determine a heading value.
This works
Question
Now I want the heading to change when I use the search2 form in the results page.
How can I use the values from the search criteria in the search1 and override search2 values in the results page when a user chooses new criteria to run a new report on the results page?
I am modifying someone's code so it has to be done like this.
Can someone suggest a link so I get some information?
please clarify your question...
Using the search criteria and the value which you have entered in your first search page go to your action class.
There you have to check what are your search criteria.
Based on the criteria your codes for selecting values will be get differentiated.
That is you have to use if else if or some switch for each case according to your criteria.
Then in each case you have to bind your values into a list(if it is a server side coding.) and return the control to forwarding 2nd search page.
If it is a client side coding, you just need to return to 2nd page.
In the second page at top you can put your search boxes as in 1st page. then you can get the values from the list and print them, if its server side coding.
If its client side coding, get the selection value for criteria from action page , find the results using your calculations. print it..
the same action class can be used for your second page's search field also..
while submitting the form, keep a hidden field which will specify the name of your page, so that we can identify which search criteria is printing result, using that value you will be able to change your header values also.
I am using 2 select tags. Their content can be modified inside the web page(via javascript).
By default grails will take only the selected option (or all selected options if multiple is enabled) and pass it to the controller.
How could I pass to the controller all the available rows from a select box ?
Maintain a secondary hidden list which has all elements selected. Then this list will get sent as well?
Or I guess you could maintain a hidden form element containing some sort of delimited list of names (but then you might get problems choosing a delimiter and escaping the values)
All,
BACKGROUND: I have a collection_select statement that displays a dropdown box.
OBJECTIVE: I'd like the dropdown to be an image that the user clicks to see the collection rather than the default box + down arrow that appears.
You need something like this plugin for jQuery. It allows you to replace a normal select with a custom one based on your wants. You would have to write your own select helper since you need to add the attributes to the select options that this plugin requires. If you get started and need help, post back here with what you're stuck on.