org.apache.tapestry5
Interface Field

All Superinterfaces:
ClientElement
All Known Implementing Classes:
AbstractField, AbstractTextField, Checkbox, Checklist, DateField, KaptchaField, Palette, PasswordField, Radio, RadioGroup, Select, TextArea, TextField, Upload

public interface Field
extends ClientElement

Defines a field within a form. Fields have a control name that is used when rendering and, later, when the form is submitted, to identify the query parameter.

Timing is important, as components may render multiple times, due to looping and other factors. Generally, a component's getControlName() will only be accurate after it has rendered. In some cases, when generating JavaScript for example, it is necessary to wait until the end of the current Heartbeat to ensure that all components have had thier chance to render.


Method Summary
 String getControlName()
          Returns the value used as the name attribute of the rendered element.
 String getLabel()
          Returns a user presentable (localized) label for the field, which may be used inside <label> elements on the client, and inside client or server-side validation error messages.
 boolean isDisabled()
          Returns true if the field is disabled; A disabled field will render a disabled attribute so that it is non-responsive on the client (at least, until its disabled status is changed on the client using JavaScript).
 boolean isRequired()
          Returns true if this field required (as per FieldValidator.isRequired()).
 
Methods inherited from interface org.apache.tapestry5.ClientElement
getClientId
 

Method Detail

getControlName

String getControlName()
Returns the value used as the name attribute of the rendered element. This value will be unique within an enclosing form, even if the same component renders multiple times.

See Also:
FormSupport.allocateControlName(String)

getLabel

String getLabel()
Returns a user presentable (localized) label for the field, which may be used inside <label> elements on the client, and inside client or server-side validation error messages.

Returns:
the label
See Also:
Label

isDisabled

boolean isDisabled()
Returns true if the field is disabled; A disabled field will render a disabled attribute so that it is non-responsive on the client (at least, until its disabled status is changed on the client using JavaScript). A disabled field will ignore any value passed up in a form submit request. Care must be taken if the disabled status of a field can change between the time the field is rendered and the time the enclosing form is submitted.


isRequired

boolean isRequired()
Returns true if this field required (as per FieldValidator.isRequired()).

Returns:
true if a non-blank value is required for the field


Copyright © 2003-2012 The Apache Software Foundation.