Hi

How do you initialize your source values on submit ?


2010/11/9 hese <1024h...@gmail.com>

>
> hi
>
> I have a form in which I use a grid with an encoder.  Strangely when I
> include the encoder attribute in the grid component onSubmit() or
> onSuccessFrom...() dont get called.  When I remove the the encoder
> attribute
> they are called.
>
>
> Any ideas???
>
> TML
>
>  <form t:type="form" t:id="upload" t:context="id">
> <t:errors/>
>  <t:upload t:id="file" class="text medium" />
>  <t:submit class="button" value="${message:button.make}" t:id="make" />
>  <t:submit class="button" value="${message:button.upload}" t:id="save"/>
>
> <table>
>  <t:grid t:id="tags1" t:source="tagRows" t:row="tagRow"
> t:encoder="tagRowEncoder" t:rowclass="prop:evenodd.next">
> </t:grid>
> </table>
>
> </form>
>
>
> JAVA
>
> @Property
>        private TagRowEncoder tagRowEncoder;
>
> void onPrepare() {
>                tagRowEncoder = new TagRowEncoder();
>        }
>
>
> private class TagRowEncoder implements ValueEncoder<TagRow> {
>
>        @Override
>        public String toClient(TagRow value) {
>                        Long key = value.getKey();
>                        return key.toString();
>                }
>
>        @Override
>                public TagRow toValue(String keyAsString) {
>                        long key = Common.toLong(keyAsString);
>                        for (TagRow holder : tagRows) {
>                                if (holder.getKey() == key) {
>                                        return holder;
>                                }
>                        }
>                        throw new IllegalArgumentException("Received key \""
> + key
>                                        + "\" which has no counterpart in
> this collection: " + tagRows);
>                }
> }
> --
> View this message in context:
> http://tapestry.1045711.n5.nabble.com/form-submit-doesnt-work-when-using-an-encoder-tp3257152p3257152.html
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>


-- 
Regards,
Christophe Cordenier.

Committer on Apache Tapestry 5
Co-creator of wooki @wookicentral.com

Reply via email to