multiple select tag

View: New views
9 Messages — Rating Filter:   Alert me  

multiple select tag

by Callaway, Pamela :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.

 

Hi, Has anyone gotten the multiple select tag to work?  This one:

http://docs.codehaus.org/display/GRAILS/Contribute+a+Tag#ContributeaTag-multipleselect

 

I am trying according to the example but I cannot get it to work.  It just shows a single select.

<g:select from="${JsecUser.list()}" optionKey="id" name="users" multiple />

 

I added MultipleSelectTagLib.groovy to my taglibs folder, but it doesn’t seem to do anything.

 

Thanks,

 

Pam

 


Re: multiple select tag

by Jason St Louis :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I think the usage example is wrong. I got it working like this:

<g:multiselect multiple="multiple" optionKey="id" from="${theList}"
name="selectListName"></g:multiselect>

Jason

On Thu, May 15, 2008 at 1:54 PM, Callaway, Pamela <pcallaway@...> wrote:

>
>
> Hi, Has anyone gotten the multiple select tag to work?  This one:
>
> http://docs.codehaus.org/display/GRAILS/Contribute+a+Tag#ContributeaTag-multipleselect
>
>
>
> I am trying according to the example but I cannot get it to work.  It just
> shows a single select.
>
> <g:select from="${JsecUser.list()}" optionKey="id" name="users" multiple />
>
>
>
> I added MultipleSelectTagLib.groovy to my taglibs folder, but it doesn't
> seem to do anything.
>
>
>
> Thanks,
>
>
>
> Pam
>
>

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



Re: multiple select tag

by Peter Ledbrook-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> Hi, Has anyone gotten the multiple select tag to work?  This one:
>
> http://docs.codehaus.org/display/GRAILS/Contribute+a+Tag#ContributeaTag-multipleselect

Pamela,

<g:select/> should now work as a multi-select if the "value" attribute
is a collection. I would leave the custom <g:multiSelect/> tag alone,
since it isn't maintained as far as I know. If you have any problems
using <g:select/> as a multi-select box, then let us know. I'm
guessing this means that the documentation needs updating to reflect
the change :)

Cheers,

Peter

--
Software Engineer
G2One, Inc.
http://www.g2one.com/

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



RE: multiple select tag

by Callaway, Pamela :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Ah, okay, now it works!  I added it to the documentation:
http://docs.codehaus.org/display/GRAILS/Tag+-+select



-----Original Message-----
From: Peter Ledbrook [mailto:peter@...]
Sent: Friday, May 16, 2008 3:01 AM
To: user@...
Subject: Re: [grails-user] multiple select tag

> Hi, Has anyone gotten the multiple select tag to work?  This one:
>
> http://docs.codehaus.org/display/GRAILS/Contribute+a+Tag#ContributeaTag-multipleselect

Pamela,

<g:select/> should now work as a multi-select if the "value" attribute
is a collection. I would leave the custom <g:multiSelect/> tag alone,
since it isn't maintained as far as I know. If you have any problems
using <g:select/> as a multi-select box, then let us know. I'm
guessing this means that the documentation needs updating to reflect
the change :)

Cheers,

Peter

--
Software Engineer
G2One, Inc.
http://www.g2one.com/

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



Re: multiple select tag

by Peter Ledbrook-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

2008/5/16 Callaway, Pamela <pcallaway@...>:
> Ah, okay, now it works!  I added it to the documentation:
> http://docs.codehaus.org/display/GRAILS/Tag+-+select

Do you mind raising an issue for the user guide? That really needs to
be updated if it doesn't mention the multi-select option.

Thanks,

Peter

--
Software Engineer
G2One, Inc.
http://www.g2one.com/

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



RE: multiple select tag

by Callaway, Pamela :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hey, it doesn't seem to be showing the already-selected items in the select tag... am I missing the correct syntax?
<g:select name="users" from="${JsecUser.list() }" value="${jsecRole.users}" optionKey="id" multiple="multiple" noSelection="['':'']"/>

Users is a TreeSet, when I print it out it does contain a user.  And JsecUser.list() is all the users in the system.

Thanks,

Pam

-----Original Message-----
From: Callaway, Pamela [mailto:pcallaway@...]
Sent: Friday, May 16, 2008 10:14 AM
To: user@...
Subject: RE: [grails-user] multiple select tag

Ah, okay, now it works!  I added it to the documentation:
http://docs.codehaus.org/display/GRAILS/Tag+-+select



-----Original Message-----
From: Peter Ledbrook [mailto:peter@...]
Sent: Friday, May 16, 2008 3:01 AM
To: user@...
Subject: Re: [grails-user] multiple select tag

> Hi, Has anyone gotten the multiple select tag to work?  This one:
>
> http://docs.codehaus.org/display/GRAILS/Contribute+a+Tag#ContributeaTag-multipleselect

Pamela,

<g:select/> should now work as a multi-select if the "value" attribute
is a collection. I would leave the custom <g:multiSelect/> tag alone,
since it isn't maintained as far as I know. If you have any problems
using <g:select/> as a multi-select box, then let us know. I'm
guessing this means that the documentation needs updating to reflect
the change :)

Cheers,

Peter

--
Software Engineer
G2One, Inc.
http://www.g2one.com/

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



RE: multiple select tag

by Callaway, Pamela :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Done!
http://jira.codehaus.org/browse/GRAILS-2961


-----Original Message-----
From: Peter Ledbrook [mailto:peter@...]
Sent: Friday, May 16, 2008 10:38 AM
To: user@...
Subject: Re: [grails-user] multiple select tag

2008/5/16 Callaway, Pamela <pcallaway@...>:
> Ah, okay, now it works!  I added it to the documentation:
> http://docs.codehaus.org/display/GRAILS/Tag+-+select

Do you mind raising an issue for the user guide? That really needs to
be updated if it doesn't mention the multi-select option.

Thanks,

Peter

--
Software Engineer
G2One, Inc.
http://www.g2one.com/

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



Re: multiple select tag

by Peter Ledbrook-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Try this:

> <g:select name="users" from="${JsecUser.list() }" value="${jsecRole.users*.id}" optionKey="id" noSelection="['':'']"/>

The "*." notation is called the Groovy spread operator and effectively
expands to:

  users.collect { it.id }

So basically your values need to match the option key, not the items
in the "from" list. This is also not/badly documented :( Could you
update GRAILS-2961 :)

Thanks,

Peter

--
Software Engineer
G2One, Inc.
http://www.g2one.com/

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



RE: multiple select tag

by Callaway, Pamela :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thanks!  It works.  And makes sense.  The JIRA is updated too.

Pam

-----Original Message-----
From: Peter Ledbrook [mailto:peter@...]
Sent: Friday, May 16, 2008 11:07 AM
To: user@...
Subject: Re: [grails-user] multiple select tag

Try this:

> <g:select name="users" from="${JsecUser.list() }" value="${jsecRole.users*.id}" optionKey="id" noSelection="['':'']"/>

The "*." notation is called the Groovy spread operator and effectively
expands to:

  users.collect { it.id }

So basically your values need to match the option key, not the items
in the "from" list. This is also not/badly documented :( Could you
update GRAILS-2961 :)

Thanks,

Peter

--
Software Engineer
G2One, Inc.
http://www.g2one.com/

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


LightInTheBox - Buy quality products at wholesale price