Skip to main content

SelectManyListbox validate error

3 replies [Last post]
jrosenbl
Offline
Joined: 2009-06-11
Points: 0

I am moving an application from struts to jsf1.2, on jboss 4.2.2 i.e. the Mojarra implementation. I have 2 listboxes in a form with different lists in each. I use javascript to move entries from one listbox to the other before submitting the form. If the list returned on the one listbox contains entries that weren't in the original list provided to that listbox as SelectItem, then jsf throws a validation error.

After looking through the api for UISelectMany and the jsf1.2 spec section 4.1.15.3 it seems that SelectMany will only allow you to return values that were in the original list.

'4.1.15.3 Methods
UISelectMany must provide a specialized validate() method which ensures that any
decoded values are valid options (from the nested UISelectItem and UISelectItems
children).'

Is my reading of this correct or am I doing something wrong. I then took the code from http://balusc.blogspot.com/2007/09/objects-in-hselectonemenu.html and rewrote it for 2 listboxes with different values in each and got the same validation error.

Thanks for any comments.

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Jim Driscoll

On 6/11/09 8:24 PM, webtier@javadesktop.org wrote:
> I am moving an application from struts to jsf1.2, on jboss 4.2.2 i.e. the Mojarra implementation. I have 2 listboxes in a form with different lists in each. I use javascript to move entries from one listbox to the other before submitting the form. If the list returned on the one listbox contains entries that weren't in the original list provided to that listbox as SelectItem, then jsf throws a validation error.
>
> After looking through the api for UISelectMany and the jsf1.2 spec section 4.1.15.3 it seems that SelectMany will only allow you to return values that were in the original list.

Yes, that's the case. There's a way to do this in JSF 2, which I've
blogged, but that won't be final for a few months still.

Offhand, the only way I think you could do this in JSF 1.2 would be to
develop a custom component - or use an existing component library that
already does this. I know Trinidad has this, and I think Richfaces does
too.

JSF is a component based architecture. If you're rolling your own
components, you're doing extra work when you probably don't have to.

Jim

---------------------------------------------------------------------
To unsubscribe, e-mail: webtier-unsubscribe@glassfish.dev.java.net
For additional commands, e-mail: webtier-help@glassfish.dev.java.net

jrosenbl
Offline
Joined: 2009-06-11
Points: 0

Thanks Jim

I don't really want to start developing custom components when it seems that what I need will be provided in Richfaces.

So I've implemented a temporary workaround (not really satisfactory) till I get some time to look at Richfaces.

Jonathan

Jim Driscoll

Or Trinidad :-)

They call it a "shuttle".

Jim

On 6/14/09 10:29 PM, webtier@javadesktop.org wrote:
> Thanks Jim
>
> I don't really want to start developing custom components when it seems that what I need will be provided in Richfaces.
>
> So I've implemented a temporary workaround (not really satisfactory) till I get some time to look at Richfaces.
>
> Jonathan
> [Message sent by forum member 'jrosenbl' (jrosenbl)]
>
> http://forums.java.net/jive/thread.jspa?messageID=351129
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: webtier-unsubscribe@glassfish.dev.java.net
> For additional commands, e-mail: webtier-help@glassfish.dev.java.net
>

---------------------------------------------------------------------
To unsubscribe, e-mail: webtier-unsubscribe@glassfish.dev.java.net
For additional commands, e-mail: webtier-help@glassfish.dev.java.net