You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Joel Trunick <Jo...@SmartPrice.com> on 2003/03/03 20:54:43 UTC

Field labels for non-fields

How can I have a field label for a non-field. For example, I have a
drop-down box that can have an error. How do I tell the delegate to show the
label for the drop-down as being in error? It seems a hidden field might
work, but that seems like a kludge.

Thanks,
Joel

RE: Field labels for non-fields

Posted by "Howard M. Lewis Ship" <hl...@attbi.com>.
Yes, you can connect a FieldLabel to a non-ValidField.  Set the field
parameter of the FieldLabel to the component (PropertySelection, TextArea,
etc.).
You must also set the displayName parameter of the FieldLabel, since the
other form components do not provide a displayName.

In your form's listener method, you can do the following:

IValidationDelegate delegate = ...

IFormComponent c = (IFormComponent)getComponent("foo");
delegate.setFormComponent(c);
delegate.record("An Error Message", null, null);

--
Howard M. Lewis Ship
Creator, Tapestry: Java Web Components
http://jakarta.apache.org/proposals/tapestry



> -----Original Message-----
> From: Joel Trunick [mailto:Joel@SmartPrice.com] 
> Sent: Monday, March 03, 2003 2:55 PM
> To: Tapestry users
> Subject: Field labels for non-fields
> 
> 
> 
> How can I have a field label for a non-field. For example, I 
> have a drop-down box that can have an error. How do I tell 
> the delegate to show the label for the drop-down as being in 
> error? It seems a hidden field might work, but that seems 
> like a kludge.
> 
> Thanks,
> Joel
>