Try something like this:
Date test:
Providing a label like this worked fine before with other components, but it will not
work with DateInput. Tapestry will complain that it "Could not find coercion from
type com.packtpub.celebrities.components.DateInput to type org.apache.tapestry.
Field". In other words, Tapestry expected that DateInput is an instance of Field,
while it isn't. So let's make it to be a Field then!
Making DateInput a Field
To be a rightful member of the family of Form components that receive user input
and can display validation errors, a custom component should implement the Field
interface that contains four methods:
String getClientId()??”should return a unique ID for the
given component.
String getLabel()??”naturally, should return a label.
String getElementName()??”should return a name that will become the
content of the component's name attribute.
??? ??? ???
Creating Custom Components
[ 218 ]
boolean isDisabled()??”should define whether the component is disabled
(when it is typically greyed out and cannot accept user input).
Let's begin with the simplest.
Pages:
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273