symfony API

sfValidatorChoice Class

You are currently browsing
the website for symfony 1

Visit the Symfony2 website


« Back to API menu

1.3 API OpenSearch

Packages

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

sfValidatorChoice validates than the value is one of the expected values.

Method Summary

  • array cleanMultiple($value)
    Cleans a value when multiple is true.
  • configure($options, $messages)
    Configures the current validator.
  • doClean()
    @see sfValidatorBase
  • getChoices()
  • Boolean inChoices($value, $choices)
    Checks if a value is part of given choices (see bug #4212)

Methods inherited from sfValidatorBase

addMessage , addOption , addRequiredOption , asString , clean , configure , doClean , getCharset , getDefaultMessages , getDefaultOptions , getEmptyValue , getErrorCodes , getMessage , getMessages , getMessagesWithoutDefaults , getOption , getOptions , getOptionsWithoutDefaults , getRequiredOptions , hasOption , isEmpty , setCharset , setDefaultMessage , setDefaultMessages , setDefaultOptions , setInvalidMessage , setMessage , setMessages , setOption , setOptions , setRequiredMessage , __construct

Method Details

  • (array) cleanMultiple ($value) Browse code

    $value The submitted value

    Cleans a value when multiple is true.

    returns The cleaned value

  • configure ($options, $messages) Browse code

    $options An array of options
    $messages An array of error messages

    Configures the current validator.


    Available options:

    * choices: An array of expected values (required)
    * multiple: true if the select tag must allow multiple selections
    * min: The minimum number of values that need to be selected (this option is only active if multiple is true)
    * max: The maximum number of values that need to be selected (this option is only active if multiple is true)

  • doClean () Browse code

    @see sfValidatorBase

  • getChoices () Browse code

  • (Boolean) inChoices ($value, $choices) Browse code

    $value The value to check
    $choices The array of available choices

    Checks if a value is part of given choices (see bug #4212)