symfony API

sfFormField Class

« Back to API menu

action

addon

autoload

cache

command

config

controller

creole

database

debug

exception

filter

form

generator

helper

i18n

log

plugin

propel

request

response

routing

storage

task

test

user

util

validator

view

widget

You are currently browsing the symfony API for the 1.1 version. Switch to:

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

Inheritence

sfFormFieldSchema  <  sfFormField

Method Summary

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

Method Details

  • (Boolean) hasError ()

    Returns true is the field has an error.

    returns true if the field has some errors, false otherwise

  • __construct ($widget, $parent = null, $name, $value, $error = null)

    $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.

  • (Exception) getToStringException ()

    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.

  • (string) render ($attributes = array())

    $attributes An array of HTML attributes

    Renders the form field.

    returns The rendered widget

  • (string) renderRow ($attributes = array(), $label = null, $help = null)

    $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

  • (mixed) getValue ()

    Returns the widget value.

    returns The widget value

  • (string) renderLabel ($label = null, $attributes = array())

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

    Returns the label tag.

    returns The label tag

  • (boolean) hasToStringException ()

    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.

  • getError ()

    Returns the error for this field.

    returns A sfValidatorError instance

  • (string) renderLabelName ()

    Returns the label name given a widget name.

    returns The label name

  • (string) renderError ()

    Returns a formatted error list.

    The formatted list will use the parent widget schema formatter.

    returns The formatted error list

  • getWidget ()

    Returns the wrapped widget.

    returns A sfWidget instance

  • (string) __toString ()

    Returns the string representation of this form field.

    returns The rendered field

  • getParent ()

    Returns the parent form field.

    returns A sfFormField instance

  • (Boolean) isHidden ()

    Returns true if the widget is hidden.

    returns true if the widget is hidden, false otherwise

  • setToStringException ($e)

    $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.