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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T01:30:46+00:00 2026-05-28T01:30:46+00:00

I have a select tag in my GSP file as <g:select name=clientId id=clientId size

  • 0

I have a select tag in my GSP file as

<g:select name="clientId" id="clientId"   size = "4" from="${com.springcommunity.fleet.partymodel.roles.ClientRole.list()}" class = "filter_combo" optionKey="id" />

i want client with id 2 is selected initially (in simple html it is achived by using selected=”selected”)

how can i do it?

  • 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-28T01:30:47+00:00Added an answer on May 28, 2026 at 1:30 am

    You need to specify the value attribute in this tag. http://grails.org/doc/2.0.x/ref/Tags/select.html

    So in your example,

    <g:select ... value="${com.springcommunity.fleet.partymodel.roles.ClientRole.get(2)}" />
    

    One thing to be aware of here is that the value that you’re selecting must be an object equal to the item in the list, and not just an id – this is where a lot of people get tripped up. So you can’t just say value=’2′, you need to specify the object in the list that you have in your from attribute.

    From the docs –

    value (optional) – The current selected value that evaluates equals()
    to true for one of the elements in the from list.

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

Sidebar

Related Questions

I have array of select tag. <select id='uniqueID' name=status> <option value=1>Present</option> <option value=2>Absent</option> </select>
I have the following SQL: SELECT * FROM [Database].dbo.[TagsPerItem] INNER JOIN [Database].dbo.[Tag] ON [Tag].Id
Let's say I have SELECT name FROM table which gives me something like foo
i have a multiple select tag, look at script please <select multiple=multiple size=5 id=cities_select>
i have a multiple select tag <select multiple=multiple size=5 id=cities_select> <option value=1>city1</option> <option value=2>city2</option>
I have a select tag that looks like this: <select style=background:#fa7171; color:#FFFFFF; name=product_type_sub id=product_type_sub
I have this piece of HTML <select multiple= name=colonia_id[] id=colonia_id[] onchange= size=10></select> I need
I have 4 tables and this query SELECT tag.id, title FROM tag LEFT JOIN
I have a select tag that looks like that: <select name=MySelect></select> At runtime, I
I have a select tag that looks like this: <select name=TZSelector id=TheTZSelector> <option>add another

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.