Pass the object key as a simple type (string/long) and setup the object in the PREPARE_FOR_SUBMIT handler.
On Fri, Oct 24, 2014 at 5:22 PM, George Christman <gchrist...@cardaddy.com> wrote: > Unfortunately the valueencoder is not an option for the form component. > > On Fri, Oct 24, 2014 at 11:09 AM, Name Surname <wintertime0...@outlook.com > > > wrote: > > > Hey George. I had a very similar situation. What you can do here is to > > make a new Encoder and put it into appropriate field. Take a look at my > > example. > > > > private class DateEncoder implements ValueEncoder<Date> { > > > > @Override > > public String toClient(Date date) { > > long timeMillis = date.getTime(); > > return Long.toString(timeMillis); > > } > > > > @Override > > public Date toValue(String timeMillisAsString) { > > long timeMillis = Long.parseLong(timeMillisAsString); > > Date date = new Date(timeMillis); > > return date; > > } > > > > } > > > > > > > > > > > > > > > > > > > > > > > > > > and I put into a grid( in your case it will be grid ) > > encoder value, something like encoder="dateEncoder". This should work > just > > fine for your case. > > > > > > > Date: Fri, 24 Oct 2014 11:02:02 -0400 > > > Subject: Could not find a coercion from type java.lang.String to type > > org.tapdemo.demo.entity.TimeSheet > > > From: gchrist...@cardaddy.com > > > To: users@tapestry.apache.org > > > > > > Hi Guys, I have a form contained within a zone where I'm passing an > > object > > > into the context value. When I submit the form I get the following > > > exception. > > > > > > *parameter #1: org.apache.tapestry5.ioc.util.UnknownValueException: > Could > > > not find a coercion from type java.lang.String to type > > > org.tapdemo.demo.entity.TimeSheet.* > > > > > > .tml > > > > > > <t:zone t:id="formZone" id="formZone"> > > > <t:form t:id="form" zone="formZone" context="ts"> > > > > > > <t:submit t:event="save" context="action.notification"/> > > > > > > java class > > > > > > public enum Action { > > > WARNING, NOTIFICATION, CERTIFICATION > > > } > > > > > > @Property > > > private TimeSheetEntity ts; > > > > > > public void onPrepareForSubmitFromForm(TimeSheetEntity ts) { > > > this.ts = ts; > > > } > > > > > > public void onSave(Action action) { > > > this.action = action; > > > } > > > > > > Aren't you able to pass an object into context? Any ideas what might be > > > happening here? > > > > > > -- > > > George Christman > > > www.CarDaddy.com > > > P.O. Box 735 > > > Johnstown, New York > > > > > > > > -- > George Christman > www.CarDaddy.com > P.O. Box 735 > Johnstown, New York >