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