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 6371225
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T01:02:06+00:00 2026-05-25T01:02:06+00:00

I am using a noSelection attribute in the <g:select> tag of the Account field

  • 0

I am using a noSelection attribute in the <g:select> tag of the Account field for my Load create view. When a user does not make a selection and clicks the “Create” button I expect the current values of all form fields to be passed to the save closure in my Load controller, which in turn re-calls the create view and populates that view with the previously mentioned current values. This does not happen for two of my form fields and I am unclear why.

Here is what the Load create view called by the /truckingmanagement/load/create controller looks like:

enter image description here

If a user does not make a selection on in the Account field and then proceeds to click the “Create” button, a load obviously cannot be created. Here is what the resulting Load create view called by the /truckingmanagement/load/save controller looks like:

enter image description here

So I have two issues here, the first of which is that the Logged By field in the second view is not populated with the value selected in the first view. Also, the drop down box is completely empty, there are no users to select from. The second issue is that the Account field drop down box is completely empty, there are no accounts to select from.

Here are the <g:select> tags used for the Logged By and Account fields in the Load create view.

Logged By field:

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

Account field:

<g:select id="account" name="account.id" from="${accountsWithCargoDestinations}" optionKey="id" noSelection="['':'-Select-']" />

Here are the create and save closures in my LoadController:

def create = {
    Role role1 = Role.findByAuthority("ROLE_ADMIN")
    Role role2 = Role.findByAuthority("ROLE_OFFICE_PROFESSIONAL")
    Role role3 = Role.findByAuthority("ROLE_DRIVER")   
    def loggedByUsers = UserRole.findAllByRoleInList([role1, role2, role3]).user

    def loadInstance = new Load()
    loadInstance.properties = params

    def accountsWithCargoDestinations = Account.findAllByUserInList(Address.findAll("from Address as addresses where addresses.cargoDestination=true").user)

    return [loadInstance:loadInstance, loggedByUsers:loggedByUsers, accountsWithCargoDestinations:accountsWithCargoDestinations]
}

def save = {
    def loadInstance = new Load(params)
    if (loadInstance.save(flush: true)) {
        flash.message = "${message(code: 'default.created.message', args: [message(code: 'load.label', default: 'Load'), loadInstance.id])}"
        redirect(action: "show", id: loadInstance.id)
    }
    else {
        System.out.println params //Trying to see if any values from the problem fields got lost.
        render(view: "create", model: [loadInstance: loadInstance])
    }
}

You will notice in the println statement in the else part of my save closure which prints out the params. When I did this I found that the value selected in the Logged By field in the first view was indeed passed from the first view all the way to this point correctly, but I don’t know why it is not displayed when the Load create view is rendered in the very next line of code, or at the least why something (i.e. loggedByUsers from the truckingmanagement/load/create controller) does not populate the Logged By field when the view is rendered. Any help would be appreciated, and sorry for the verbosity.

  • 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-25T01:02:07+00:00Added an answer on May 25, 2026 at 1:02 am

    To answer your question posed in the comment response. You might want to investigate using chain in your controller. You will need to re-work your create action a little to only instance a new loadInstance if not already present in the model. However, that should do the trick.

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

Sidebar

Related Questions

I am using a g:select tag like this: <td><g:select name=newCity id=${'newCity_' +cityData.uid} from=${cityData.name} value=${cityData.someValue}
Using SQL Server 2008 R2 we are looking for a way to select the
I'm using QCalendarWidget in PyQt to find a single date that a user clicks
Using Jenkins or Hudson I would like to create a pipeline of builds with
In my Java application I need to select a path using JFileChooser. The code
Using The Play Framework how easy would it be to allow an admin user
There is a select dropdown and I want to add "No selection" item to
Using TortoiseSVN against VisualSVN I delete a source file that I should not have
Using the http://www.ifans.com/forums/showthread.php?t=132024 post from another question i am allowing the user to enter
Using a CSS image sprite, I'm creating an 'interactive' image where hovering over certain

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.