Validation highlighting items in a multi-select list.

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Validation highlighting items in a multi-select list.

I have an app that displays items in a select list that supports multi-select...

<stripes:select name="items" multiple="true">
<stripes:options-collection collection="${actionBean.items}" />

The user can add new items (strings) to the list (via javascript) before submitting and I'm trying to validate the added items.  Note that I have javascript code that sets all the items to selected in the list before submitting.

Currently, I'm able to display a validation error and highlight the whole list by doing this in my action bean...

errors.add( "items", new SimpleError("list contains invalid item(s)") );

But I can't figure out the syntax to highlight specific items in the list.  I'm looping over the items in the list during validation and I thought this might work, but it doesn't...

errors.add( "items[" + i + "]'", new SimpleError(i + " is not valid") );

Does anyone know the syntax to make this work?


Stripes-users mailing list
[hidden email]