symfony API

sfWidgetFormSelect Class

You are currently browsing
the website for symfony 1

Visit the Symfony2 website

« Back to API menu


You are currently browsing the symfony API for the 1.4 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.

sfWidgetFormSelect represents a select HTML tag.


sfWidgetFormSelectMany  <  sfWidgetFormSelect  <  sfWidgetFormChoiceBase < sfWidgetForm < sfWidget

Method Summary

  • configure($options, $attributes)
  • array getOptionsForSelect($value, $choices)
    Returns an array of option tags for the given choices
  • string render($name, $value, $attributes, $errors)
    Renders the widget.

Methods inherited from sfWidgetFormChoiceBase

configure , getChoices , __clone

Methods inherited from sfWidgetForm

fixFormId , generateId , generateTwoCharsRange , getDefault , getIdFormat , getLabel , getParent , isHidden , needsMultipartForm , renderContentTag , renderTag , setDefault , setHidden , setIdFormat , setLabel , setParent , translate , translateAll , __construct

Methods inherited from sfWidget

addOption , addRequiredOption , attributesToHtml , attributesToHtmlCallback , configure , escapeOnce , fixDoubleEscape , getAttribute , getAttributes , getCharset , getJavaScripts , getOption , getOptions , getRequiredOptions , getStylesheets , hasOption , isXhtml , render , renderContentTag , renderTag , setAttribute , setAttributes , setCharset , setOption , setOptions , setXhtml , __construct

Method Details

  • configure ($options, $attributes)

    $options An array of options
    $attributes An array of default HTML attributes


    Available options:

    * choices: An array of possible choices (required)
    * multiple: true if the select tag must allow multiple selections

  • (array) getOptionsForSelect ($value, $choices)

    $value The selected value
    $choices An array of choices

    Returns an array of option tags for the given choices

    returns An array of option tags

  • (string) render ($name, $value, $attributes, $errors)

    $name The element name
    $value The value selected in this widget
    $attributes An array of HTML attributes to be merged with the default HTML attributes
    $errors An array of errors for the field

    Renders the widget.

    returns An HTML tag string