How do I get Grails g:select with multiple-selection with all selections when returning from the controllerSelecting multiple values from select tag - GrailsHow do you remove all the options of a select box and then add one option and select it with jQuery?Defining controller accessible variables from filters in GrailsGrails - How to update a GSP after changing a select?Getting the value from a Select tag (Grails)how to read selected radio button value in Grails?Selecting mulple values from select tag in grailsGrails multiple selectGrails loading select box from database makes it multi-selectableRender JSON-response from Controller in Grails 2.3.1Get selected value from <g:select dropdown

If you attack a Tarrasque while swallowed, what AC do you need to beat to hit it?

Why did Nick Fury not hesitate in blowing up the plane he thought was carrying a nuke?

Is there a word for pant sleeves?

Is it wise to pay off mortgage with 401k?

Best practice for printing and evaluating formulas with the minimal coding

How could Dwarves prevent sand from filling up their settlements

Managing heat dissipation in a magic wand

What to call a small, open stone or cement reservoir that supplies fresh water from a spring or other natural source?

What is this dime sized black bug with white on the segments near Loveland Colorodao?

Vehemently against code formatting

Does George B Sperry logo on fold case for photos indicate photographer or case manufacturer?

Is presenting a play showing Military characters in a bad light a crime in the US?

Farthing / Riding

Why is this python script running in background consuming 100 % CPU?

Schwa-less Polysyllabic German Noun Stems of Germanic Origin

1950s or earlier book with electrical currents living on Pluto

Why was Harry at the Weasleys' at the beginning of Goblet of Fire but at the Dursleys' after?

How to prove the emptiness of intersection of two context free languages is undecidable?

Are there historical examples of audiences drawn to a work that was "so bad it's good"?

tikz: 5 squares on a row, roman numbered 1 -> 5

Keeping the dodos out of the field

How to draw with Tikz a chord parallel to AC that passes through a point?

Was Tyrion always a poor strategist?

Filter a file list against an integer array?



How do I get Grails g:select with multiple-selection with all selections when returning from the controller


Selecting multiple values from select tag - GrailsHow do you remove all the options of a select box and then add one option and select it with jQuery?Defining controller accessible variables from filters in GrailsGrails - How to update a GSP after changing a select?Getting the value from a Select tag (Grails)how to read selected radio button value in Grails?Selecting mulple values from select tag in grailsGrails multiple selectGrails loading select box from database makes it multi-selectableRender JSON-response from Controller in Grails 2.3.1Get selected value from <g:select dropdown






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








2















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?










share|improve this question
























  • stackoverflow.com/questions/8476880/… try this

    – Vahid
    Feb 4 '15 at 18:05











  • Yes, I saw this one. It talks about getting the values from the select in the controller. I'm talking about posting them back into the select when I return to the page.

    – Joseph Nelson
    Feb 4 '15 at 18:44

















2















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?










share|improve this question
























  • stackoverflow.com/questions/8476880/… try this

    – Vahid
    Feb 4 '15 at 18:05











  • Yes, I saw this one. It talks about getting the values from the select in the controller. I'm talking about posting them back into the select when I return to the page.

    – Joseph Nelson
    Feb 4 '15 at 18:44













2












2








2








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?










share|improve this question
















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?







grails html-select






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 23 at 19:22









doelleri

14.7k54757




14.7k54757










asked Feb 4 '15 at 16:25









Joseph NelsonJoseph Nelson

638




638












  • stackoverflow.com/questions/8476880/… try this

    – Vahid
    Feb 4 '15 at 18:05











  • Yes, I saw this one. It talks about getting the values from the select in the controller. I'm talking about posting them back into the select when I return to the page.

    – Joseph Nelson
    Feb 4 '15 at 18:44

















  • stackoverflow.com/questions/8476880/… try this

    – Vahid
    Feb 4 '15 at 18:05











  • Yes, I saw this one. It talks about getting the values from the select in the controller. I'm talking about posting them back into the select when I return to the page.

    – Joseph Nelson
    Feb 4 '15 at 18:44
















stackoverflow.com/questions/8476880/… try this

– Vahid
Feb 4 '15 at 18:05





stackoverflow.com/questions/8476880/… try this

– Vahid
Feb 4 '15 at 18:05













Yes, I saw this one. It talks about getting the values from the select in the controller. I'm talking about posting them back into the select when I return to the page.

– Joseph Nelson
Feb 4 '15 at 18:44





Yes, I saw this one. It talks about getting the values from the select in the controller. I'm talking about posting them back into the select when I return to the page.

– Joseph Nelson
Feb 4 '15 at 18:44












2 Answers
2






active

oldest

votes


















0














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.






share|improve this answer






























    0














    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().






    share|improve this answer























      Your Answer






      StackExchange.ifUsing("editor", function ()
      StackExchange.using("externalEditor", function ()
      StackExchange.using("snippets", function ()
      StackExchange.snippets.init();
      );
      );
      , "code-snippets");

      StackExchange.ready(function()
      var channelOptions =
      tags: "".split(" "),
      id: "1"
      ;
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function()
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled)
      StackExchange.using("snippets", function()
      createEditor();
      );

      else
      createEditor();

      );

      function createEditor()
      StackExchange.prepareEditor(
      heartbeatType: 'answer',
      autoActivateHeartbeat: false,
      convertImagesToLinks: true,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: 10,
      bindNavPrevention: true,
      postfix: "",
      imageUploader:
      brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
      contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
      allowUrls: true
      ,
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      );



      );













      draft saved

      draft discarded


















      StackExchange.ready(
      function ()
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f28326355%2fhow-do-i-get-grails-gselect-with-multiple-selection-with-all-selections-when-re%23new-answer', 'question_page');

      );

      Post as a guest















      Required, but never shown

























      2 Answers
      2






      active

      oldest

      votes








      2 Answers
      2






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      0














      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.






      share|improve this answer



























        0














        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.






        share|improve this answer

























          0












          0








          0







          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.






          share|improve this answer













          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.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Feb 4 '15 at 20:07









          VahidVahid

          6,39921940




          6,39921940























              0














              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().






              share|improve this answer



























                0














                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().






                share|improve this answer

























                  0












                  0








                  0







                  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().






                  share|improve this answer













                  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().







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Mar 23 at 13:51









                  Douglas MendesDouglas Mendes

                  142110




                  142110



























                      draft saved

                      draft discarded
















































                      Thanks for contributing an answer to Stack Overflow!


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid


                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.

                      To learn more, see our tips on writing great answers.




                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function ()
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f28326355%2fhow-do-i-get-grails-gselect-with-multiple-selection-with-all-selections-when-re%23new-answer', 'question_page');

                      );

                      Post as a guest















                      Required, but never shown





















































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown

































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown







                      Popular posts from this blog

                      Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

                      Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

                      Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript