On Wed, 2007-06-06 at 22:47 +0200, Michael Maier wrote:
> Yes...it seems that multiple selects are not yet supported, but it is  
> very easy to write a component...
You're right, it's really easy to do this - it took about 30 minutes
and some testing :)

> just take the select component from  
> tapestry, look for "value" and the isOptionValueSelected method. I  
> changed the value to Set type
Do you have getters/setters with a Set then? Does the method signature
depend on the value?

I didn't change the type of _value to be able to use the component
with or without multiple="true", but perhaps it's better to have a
dedicated multiselect component, so the _value could also be a
collection as in your implementation...

Cheers,
Martin


>  and changed the
> 
>      protected void processSubmission(FormSupport formSupport, String  
> elementName) {
> 
>          String[] primaryKey= _request.getParameters(elementName);
>          if( primaryKey != null ) {
>              Set selectedValues= new HashSet();
>              for( String key : primaryKey ) {
> 
>                  selectedValues.add( _encoder.toValue( key ) );
>              } // for
> 
>              try {
>                  _validate.validate(selectedValues);
>                  _value= selectedValues;
> 
>              } catch (ValidationException ex) {
> 
>                  _tracker.recordError(this, ex.getMessage());
>                  return;
>              }
>          } // if
>      }
> 
> method. Now I have a "multiple-select" component which takes a value  
> parameter as a set...and it works fine...
> 
> cheers
> 
> Michael
> 
> Am 06.06.2007 um 21:51 schrieb Martin Grotzke:
> 
> > Hi,
> >
> > AFAICS doesn't the select component support the attribute
> > "multiple", only the first selected option is set on the
> > value.
> >
> > Is there some way to get this to work with support for "multiple"?
> >
> > Thx && cheers,
> > Martin
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
-- 
Martin Grotzke
http://www.javakaffee.de/blog/

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to