Documentation · ViewHelper reference

XSD schema file | vhs master

Form / SelectViewHelper

Select ViewHelper (with support for Optgroup and Option subnodes). /

  • Tag usage example

    <v:form.select additionalAttributes="{foo: 'bar'}" data="{foo: 'bar'}" name="NULL" value="[mixed]" property="NULL" class="NULL" dir="NULL" id="NULL" lang="NULL" style="NULL" title="NULL" accesskey="NULL" tabindex="123" onclick="NULL" size="NULL" disabled="NULL" multiple="1" options="{foo: 'bar'}" optionValueField="NULL" optionLabelField="NULL" sortByOptionLabel="1" selectAllByDefault="1" errorClass="'f3-form-error'">
    	<!-- tag content - may be ignored! -->
    </v:form.select>
  • Inline usage example

    {v:form.select(additionalAttributes: {foo: 'bar'}, data: {foo: 'bar'}, name: 'NULL', value: [mixed], property: 'NULL', class: 'NULL', dir: 'NULL', id: 'NULL', lang: 'NULL', style: 'NULL', title: 'NULL', accesskey: 'NULL', tabindex: 123, onclick: 'NULL', size: 'NULL', disabled: 'NULL', multiple: 1, options: {foo: 'bar'}, optionValueField: 'NULL', optionLabelField: 'NULL', sortByOptionLabel: 1, selectAllByDefault: 1, errorClass: ''f3-form-error'')}

Arguments

Argument Description Type
accesskey

Keyboard shortcut to access this element

string
additionalAttributes

Additional tag attributes. They will be added directly to the resulting HTML tag.

array
class

CSS class(es) for this element

string
data

Additional data-* attributes. They will each be added with a "data-" prefix.

array
dir

Text direction for this HTML element. Allowed strings: "ltr" (left to right), "rtl" (right to left)

string
disabled

Specifies that the input element should be disabled when the page loads

string
errorClass

CSS class to set if there are errors for this view helper

string
id

Unique (in this file) identifier for this HTML element.

string
lang

Language for this element. Use short names specified in RFC 1766

string
multiple

if set, multiple select field

boolean
name

Name of input tag

string
onclick

JavaScript evaluated for the onclick event

string
optionLabelField

If specified, will call the appropriate getter on each object to determine the label.

string
optionValueField

If specified, will call the appropriate getter on each object to determine the value.

string
options

Associative array with internal IDs as key, and the values are displayed in the select box

array
property

Name of Object Property. If used in conjunction with , "name" and "value" properties will be ignored.

string
selectAllByDefault

If specified options are selected if none was set before.

boolean
size

Size of input field

string
sortByOptionLabel

If true, List will be sorted by label.

boolean
style

Individual CSS styles for this element

string
tabindex

Specifies the tab order of this element

integer
title

Tooltip text of element

string
value

Value of input tag

mixed
Required attribute

Revision history

commit ea3893cd4d93538f6aba597d529b03ef9f1a0222
Author: Claus Due <*****@wildside.dk>
Date:   Fri Nov 2 16:37:10 2012 +0100

    [FEATURE] Form / Select, Option and Optgroup ViewHelpers

commit 6799dd6cf6c9dc26565d80b82db409c04bc066ad
Author: Claus Due <*****@wildside.dk>
Date:   Fri Nov 2 17:11:44 2012 +0100

    [TASK] Adjust Form / Select ViewHelper to new extension namespace

commit 6e343b133ae057eb43d8dbb10975f1630aa7afee
Author: Claus Due <*****@wildside.dk>
Date:   Sun Dec 2 20:13:26 2012 +0100

    [TASK] Coding guideline cleanup

commit f7d1dc1ff2266576b905878ba067d98e87ff7f75
Author: Claus Due <*****@wildside.dk>
Date:   Wed Apr 24 21:11:50 2013 +0200

    [BUGFIX] Property "multiple" on Select ViewHelper is boolean
    
    Fixes: #121

commit 6ddfe439c7f68cb3d99bc5ce2406abcb87e87e64
Author: Claus Due <*****@wildside.dk>
Date:   Wed Apr 24 21:18:55 2013 +0200

    [BUGFIX] Set "multiple" on Select ViewHelper form argument, not tag attribute
    
    This prevents any possible errors when using the "multiple" attribute by turning it into an argument rather than an attribute and manually setting/removing the actual tag attribute as needed.

commit 812925e3b1be49d9c8b7a75bab5fbc815c00601d
Author: Claus Due <*****@wildside.dk>
Date:   Wed May 22 00:06:43 2013 +0200

    [TASK] Cleanup as required by coding standards
    
    Excuse the not-using-PR-direct-to-master commit approach but this one is merely cosmetic in nature and the Travis build is failing because of it.

commit aa32ca2050a4ac2d8ff0a2183b316c7c0f2477ed
Author: Björn Fromme <*****@bjo3rn.com>
Date:   Sun May 26 16:00:15 2013 +0200

    [TASK] A*****@throws annotations

commit 5bf03b2f2ef18f6cbc6e39acf3a46db8ace6bd6e
Author: Björn Fromme <*****@bjo3rn.com>
Date:   Tue May 28 16:34:43 2013 +0200

    [BUGFIX] Avoid unnecessary 4.6+ only method usage
    
    This commit replaces all occurrences of $this->hasArgument() with isset/empty conditions and adds some fixes to adhere coding guidelines

commit 3e5ef5c3d7a7e720a2573cc57c4defad8cd4f529
Author: Björn Fromme <*****@bjo3rn.com>
Date:   Wed May 29 09:49:12 2013 +0200

    [TASK] Adhere coding guidelines

commit b796b1d1bf8375d8e7cb1140f0c1cf0e2e4fe972
Author: Cedric Ziel <*****@cedric-ziel.com>
Date:   Mon Aug 19 00:52:04 2013 +0200

    [BUGFIX] Fix missing dollar sign in string-cast

commit da31bad1d9bb058c072ddb5591e8ed907a1ae8e1
Author: Claus Due <*****@namelesscoder.net>
Date:   Tue Dec 31 23:08:37 2013 +0100

    [TASK] Happy new year!

commit d2e531da034976e6db1478eef5a8478595fd16fe
Author: Claus Due <*****@namelesscoder.net>
Date:   Sun Jan 5 00:45:10 2014 +0100

    [TASK] Migrate to using namespace core class names

commit 52bd6e41ccfef3d8193b350153912a9716e6a087
Author: Benjamin Rau <*****@codearts.at>
Date:   Tue Apr 1 21:09:00 2014 +0200

    [TASK] CGL compliance

commit da7677bc74f14e9a9300e4ba4487e52c3cb97642
Author: Claus Due <*****@namelesscoder.net>
Date:   Sun Apr 20 01:13:33 2014 +0200

    [TASK] Switch to namespaces

commit e5aa4d015557df689767b81847eb3ed625be7ec2
Author: Björn Fromme <*****@bjo3rn.com>
Date:   Fri Dec 5 11:26:33 2014 +0100

    [TASK] Whitespace fix

commit 8bb2fc5ee124ba19b0a0ab8e061c9a153fc4651f
Author: Xaver Maierhofer <*****@xwissen.info>
Date:   Sun Jan 18 17:56:13 2015 +0100

    [TASK] Reference Copyright to license.md file