symfony API

sfFormField Class

You are currently browsing
the website for symfony 1

Visit the Symfony2 website


« Back to API menu

1.1 API OpenSearch

Packages

You are currently browsing the symfony API for the 1.1 version. Switch to:
This version of symfony is not maintained anymore.
If some of your projects still use this version, consider upgrading as soon as possible.

sfFormField represents a widget bind to a name and a value.

Inheritence

sfFormFieldSchema  <  sfFormField

Method Summary

  • sfValidatorError getError()
    Returns the error for this field.
  • sfFormField getParent()
    Returns the parent form field.
  • Exception getToStringException()
    Gets the exception if one was thrown in the __toString() method.
  • mixed getValue()
    Returns the widget value.
  • sfWidget getWidget()
    Returns the wrapped widget.
  • Boolean hasError()
    Returns true is the field has an error.
  • boolean hasToStringException()
    Returns true if a form thrown an exception in the __toString() method
  • Boolean isHidden()
    Returns true if the widget is hidden.
  • string render($attributes)
    Renders the form field.
  • string renderError()
    Returns a formatted error list.
  • string renderLabel($label, $attributes)
    Returns the label tag.
  • string renderLabelName()
    Returns the label name given a widget name.
  • string renderRow($attributes, $label, $help)
    Returns a formatted row.
  • setToStringException($e)
    Sets an exception thrown by the __toString() method.
  • __construct($widget, $parent, $name, $value, $error)
    Constructor.
  • string __toString()
    Returns the string representation of this form field.

Method Details

  • (sfValidatorError) getError () Browse code

    Returns the error for this field.

    returns A sfValidatorError instance

  • (sfFormField) getParent () Browse code

    Returns the parent form field.

    returns A sfFormField instance

  • (Exception) getToStringException () Browse code

    Gets the exception if one was thrown in the __toString() method.


    This is a hack needed because PHP does not allow to throw exceptions in __toString() magic method.

  • (mixed) getValue () Browse code

    Returns the widget value.

    returns The widget value

  • (sfWidget) getWidget () Browse code

    Returns the wrapped widget.

    returns A sfWidget instance

  • (Boolean) hasError () Browse code

    Returns true is the field has an error.

    returns true if the field has some errors, false otherwise

  • (boolean) hasToStringException () Browse code

    Returns true if a form thrown an exception in the __toString() method


    This is a hack needed because PHP does not allow to throw exceptions in __toString() magic method.

  • (Boolean) isHidden () Browse code

    Returns true if the widget is hidden.

    returns true if the widget is hidden, false otherwise

  • (string) render ($attributes) Browse code

    $attributes An array of HTML attributes

    Renders the form field.

    returns The rendered widget

  • (string) renderError () Browse code

    Returns a formatted error list.


    The formatted list will use the parent widget schema formatter.

    returns The formatted error list

  • (string) renderLabel ($label, $attributes) Browse code

    $label The label name (not null to override the current value)
    $attributes Optional html attributes

    Returns the label tag.

    returns The label tag

  • (string) renderLabelName () Browse code

    Returns the label name given a widget name.

    returns The label name

  • (string) renderRow ($attributes, $label, $help) Browse code

    $attributes An array of HTML attributes to merge with the current attributes
    $label The label name (not null to override the current value)
    $help The help text (not null to override the current value)

    Returns a formatted row.


    The formatted row will use the parent widget schema formatter.
    The formatted row contains the label, the field, the error and
    the help message.

    returns The formatted row

  • setToStringException ($e) Browse code

    $e The exception thrown by __toString()

    Sets an exception thrown by the __toString() method.


    This is a hack needed because PHP does not allow to throw exceptions in __toString() magic method.

  • __construct ($widget, $parent, $name, $value, $error) Browse code

    $widget A sfWidget instance
    $parent The sfFormField parent instance (null for the root widget)
    $name The field name
    $value The field value
    $error A sfValidatorError instance

    Constructor.

  • (string) __toString () Browse code

    Returns the string representation of this form field.

    returns The rendered field