Thilo, thanks for helping me. Now works fine with SelectModel.

Best regards,


*Marcos Héctor Trotti*


2014-05-05 4:02 GMT-03:00 Thilo Tanner <thilo.tan...@reprisk.com>:

> Hi Marcos,
>
> Instead of using List<UploadedFile> uploadedFiles as your model, you need
> to provide a SelectModel instance for your uploaded files. Extend
> AbstractSelectModel and return OptionModel instances with your preferred
> label.
>
> I hope this helps.
>
> Best,
> Thilo
>
>
> ________________________________________
> From: Marcos Héctor Trotti <marcostro...@gmail.com>
> Sent: Sunday, May 04, 2014 01:34
> To: users@tapestry.apache.org
> Subject: Value Encoder Problem
>
> Hi, All!
>
> I'm working in a small web application in which I need upload a set of
> files and choose one from a select component.
>
> My encoder code is:
> ..
>
>     private List<UploadedFile> uploadedFiles;
> ...
> public ValueEncoder<UploadedFile> getFilesEncoder() {
>
>         return new ValueEncoder<UploadedFile>() {
>
> public String toClient(UploadedFile value) {
>                 return value.getFileName();
>             }
>
>             public UploadedFile toValue(String id) {
>             for (UploadedFile file : uploadedFiles) {
>             if (file.getFileName().equals(id))
>             return file;
> }
>                 return null;
>             }
>         };
>     }
>
> My select code is:
>
> <select t:type="select" t:id="targetInterfaceFile" t:value="filename"
> t:model="uploadedFiles"  t:encoder="getFilesEncoder()"
>                     t:blankOption="ALWAYS" t:blankLabel="Choose..."
> t:validate="required"/
>
> The problem is that when I upload a set of files, In the select I can't see
> files names but I see names like "org.tapestry...@ef1aeqa" for each file
>
> Best regards,
>
> *Marcos Héctor Trotti*
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>

Reply via email to