Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1061231
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T18:26:46+00:00 2026-05-16T18:26:46+00:00

I have a Contact Domain class that can be associated with multiple Organizations, which

  • 0

I have a Contact Domain class that can be associated with multiple Organizations, which are also domain classes. I want to use a multiple selection box to allow the user to select the organizations that are associated with the current contact. The selection box is populated with the available organizations. How do I assign the selected items to the organizations list in my Contact class?

 <g:select name="organizations.id"  
           multiple="multiple" 
           optionKey="id" 
           from="${com.ur.Organization.list()}" 
           value="${contact?.organizations}" />

The above is what I am currently trying, and while it does populate the selection with organizations it doesn’t seem to put the selected items in my organizations field.

Thanks for any advice.

Edit:
Incorporated comments from krsjunk and omarello.

Here’s an abbreviated version of the domain classes.

class Contact{
    static searchable = true
    static mapping = {
        sort "lastName"
    }
    String firstName
    String lastName
    .  
    .
    .
    static belongsTo = [organizations:Organization, projects:Project]
}

class Organization {
    static searchable = true
    static mapping = {
        sort "name"
    }
    String name
    static hasMany = [contacts:Contact]
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T18:26:47+00:00Added an answer on May 16, 2026 at 6:26 pm

    Well just change the name to

    <g:select name="organizations"  multiple="multiple" 
              optionKey="id" 
              from="${com.ur.Organization.list()}" 
              value="${contact?.organizations}" />
    

    Should work fine, just tried it.

    Note my domain definitions look like this, (just in case you have something different

    class Contact {
    
        static constraints = {
        }
    
        static hasMany = [organizations:Organization]
    
        String name
    }
    
    
    class Organization {
    
        static constraints = {
        }
    
        static hasMany = [contacts:Contact]
        static belongsTo = [Contact]
    
        String name
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

When picking out contact details, is there a built in domain class they can
I am trying to build a domain model that will allow me to manage
I have a Silverlight Application, that uploads file(s) to a Sharepoint Site. I got
I have inheritance in Hibernate for where Connection is my parent entity, and MobilePhoneConnection
I am using Contact Form 7 with Wordpress, but I am experiencing an email
I have a pure css menu with dropdowns, in IE8 and FF it works
i want to implement asp.net role provider to assign users over my LAN to
I'm developing a Grails (Version 1.3.3) Web-Application using the Grails Spring-Security Plugin, Spring-Security-Core-1.0.1 (which,
I realise this question has been asked 100 times, but i've looked through the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.