On Apr 7, 2009, at 4/71:40 AM , Andrew Court wrote:


Thanks for the reply.

Okay, but either way, it's still just converting a string to a java.sql.Date
and back again.


Yes, but in one case, the user is inputting the value, which means you have to validate the input (you have to validate the input for a hidden form field, as well, of course, but with different semantics; in one case, you're checking for correct format/etc., and in the other, you're making sure there was no tampering). The translator interface provides the hooks for doing the format conversions, validations, etc. that you need for user-input data.


It still doesn't explain why the encoder is not working for the Hidden
field. Just wondering if anyone else has encountered this problem, and
whether it's a bug, or just something i'm overlooking?


That, I can not say; you haven't posted the code for your value encoder. ;)

Robert

PS - I realize that the translator vs. encoder issue seems to be splitting hairs; check out past discussions on this (or maybe the dev?) list between, eg, HLS, Kevin Menard, and myself regarding Translator/Encoder/Coercer madness. :)


Andrew



Robert Zeigler wrote:

There's a fundamental difference between text field and hidden field:
one is intended for direct user-input data, and the other is not.
Hence, the use of translator vs. encoder.

Robert


On Apr 6, 2009, at 4/67:09 PM , Andrew Court wrote:


I'm seeing an issue with the new Hidden field component in 5.1.0.2.

I've written a ValueEncoder to translate between string and
java.sql.Date,
but this throws a class cast exception when used as the encoder
parameter
for the hidden field.

If I use a regular TextField component and use a ValueTranslator,
then this
works without problem.

The question is, why does Hidden field use an encoder, when
TextField uses a
translator?  Perhaps there should be some consistency here.

--
View this message in context:
http://www.nabble.com/Hidden-field-encoder-problem-tp22919903p22919903.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


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org




--
View this message in context: 
http://www.nabble.com/Hidden-field-encoder-problem-tp22919903p22922658.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


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to