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

  • SEARCH
  • Home
  • 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 6332767
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T18:20:52+00:00 2026-05-24T18:20:52+00:00

This question is a continuation of the question here . The code below is

  • 0

This question is a continuation of the question here.

The code below is from one of my views and it works fine, but I am having difficulty moving this code to a controller. If my packages and classes are not clear from the code below, look at the previous question to see how they are arranged.

<g:set var="roleAdmin" value='${org.me.example.userrole.Role.findByAuthority("ROLE_ADMIN")}' />
<g:set var="roleOfficeProfessional" value='${org.me.example.userrole.Role.findByAuthority("ROLE_OFFICE_PROFESSIONAL")}' />
<g:set var="roleDriver" value='${org.me.example.userrole.Role.findByAuthority("ROLE_DRIVER")}' />
<g:select name="loggedBy.id" from="${org.me.example.userrole.UserRole.findAllByRoleInList([roleAdmin, roleOfficeProfessional, roleDriver]).user}" optionKey="id" value="${loadInstance?.loggedBy?.id}"  />   

It may be a basic misunderstanding on my part, but I cannot get ANY of the methods that I have made in my controllers to work in my views, only the methods that Grails has created (i.e. list, create, delete, edit, etc.) will work. Any assistance / recommendations would be helpful.

  • 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-24T18:20:53+00:00Added an answer on May 24, 2026 at 6:20 pm

    The from and value attributes don’t come from methods/actions in your controller. They come from, generally, the request object. I gave you the code in your other thread to do this correctly, but here it is again, slightly more detailed…

    class SomeController {
    
       def show = {
         def loadInstance = whateverYouGetItFrom
         def users = UserRole.findAllByRoleInList([roleAdmin, roleOfficeProfessional, roleDriver]).user
         [loadInstance:loadInstance,users:users]
       }
    }
    

    And then you would have a show.gsp which contains

    <g:select name="loggedBy.id" from="${users}" optionKey="id" value="${loadInstance?.loggedBy?.id}"  />
    

    If I’m misunderstanding your question, please give us some more details.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This question is continuation of my question . Here is problematic code. a.h: #include
This question is a continuation of this one but asking for a more specific
This is in continuation with the question posted here: Finding the center of mass
This is a continuation question from a previous question I have asked I now
This question is in continuation to my previous post located here . Since there
This question is a continuation of my last one, regarding How to make Ruby
This is an in-depth continuation of my question from earlier this morning , which
this is a continuation from a previous JQueryUI Autocomplete question, I asked . This
A continuation from this question I need a SQL statement that returns the number
So this is a continuation from my last question - So the question was

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.