Documentation · ViewHelper reference

Form / TextfieldViewHelper


View Helper which creates a text field ().

Examples

Example

<f:form.textfield name="myTextBox" value="default value" />

Output



  • Tag usage example

    <f:form.textfield additionalAttributes="{foo: 'bar'}" data="{foo: 'bar'}" required="1" type="'text'" name="NULL" value="[mixed]" property="NULL" autofocus="NULL" disabled="NULL" maxlength="[anySimpleType]" readonly="NULL" size="[anySimpleType]" placeholder="NULL" pattern="NULL" errorClass="'f3-form-error'" class="NULL" dir="NULL" id="NULL" lang="NULL" style="NULL" title="NULL" accesskey="NULL" tabindex="123" onclick="NULL">
    	<!-- tag content - may be ignored! -->
    </f:form.textfield>
  • Inline usage example

    {f:form.textfield(additionalAttributes: {foo: 'bar'}, data: {foo: 'bar'}, required: 1, type: ''text'', name: 'NULL', value: [mixed], property: 'NULL', autofocus: 'NULL', disabled: 'NULL', maxlength: [anySimpleType], readonly: 'NULL', size: [anySimpleType], placeholder: 'NULL', pattern: 'NULL', errorClass: ''f3-form-error'', class: 'NULL', dir: 'NULL', id: 'NULL', lang: 'NULL', style: 'NULL', title: 'NULL', accesskey: 'NULL', tabindex: 123, onclick: 'NULL')}

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
autofocus

Specifies that an input should automatically get focus when the page loads

string
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
maxlength

The maxlength attribute of the input field (will not be validated)

anySimpleType
name

Name of input tag

string
onclick

JavaScript evaluated for the onclick event

string
pattern

HTML5 validation pattern

string
placeholder

The placeholder of the textfield

string
property

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

string
readonly

The readonly attribute of the input field

string
required

If the field is required or not

boolean
size

The size of the input field

anySimpleType
style

Individual CSS styles for this element

string
tabindex

Specifies the tab order of this element

integer
title

Tooltip text of element

string
type

The field type, e.g. "text", "email", "url" etc.

string
value

Value of input tag

mixed
Required attribute

Revision history

commit aa1fb6f5adb8a799e79dbe54192d49b336a26786
Author: Sebastian Kurfürst <*****@typo3.org>
Date:   Tue Mar 16 08:49:45 2010 +0000

    [!!!][TASK] Fluid: Raised version number to 1.1.0. This  version needs Extbase 1.1.0 as well!
    [TASK] Fluid: Backported all changes from Fluid v5 again. This includes mostly some internal restructurings.
    [!!!][TASK] Fluid (ViewHelpers): The <f:base> ViewHelper now creates a self-closing tag instead of an opening/closing tag. This is standards-conformant, but will BREAK IE6!!

commit 186bdaeac89820779f91853b830cc95d60c7ad58
Author: Bastian Waidelich <*****@typo3.org>
Date:   Tue Jul 13 09:42:26 2010 +0000

    [-TASK] Fluid: R*****@version annotation from all Fluid classes to ease the backporting process. Relates to #8835 (backported from Fluid package)

commit 1d36de6ed90007e324b773782e8f0a1d1c1191a2
Author: Bastian Waidelich <*****@typo3.org>
Date:   Tue Jul 13 10:12:30 2010 +0000

    [-TASK] Fluid: R*****@package/@subpackage annotations from all Fluid classes. They have already been removed in FLOW3 packages in r2813.

commit 472451987ca0530fa5828bb0b79fcafa2f905a35
Author: Bastian Waidelich <*****@typo3.org>
Date:   Fri Nov 19 20:58:09 2010 +0000

    [-TASK] Fluid: R*****@scope annotations as they are not used in v4

commit dd8928aed4c119d8db37322acb91ded24ba5cc35
Author: Bastian Waidelich <*****@typo3.org>
Date:   Thu Dec 30 16:21:11 2010 +0000

    [+TASK] Fluid (ViewHelpers): Fix, cleanup and extend inline documentation of ViewHelpers
    
    Resolves #10908

commit 0401b77da4a7e019f40f60737724da2d6238f521
Author: Sebastian Kurfuerst <*****@typo3.org>
Date:   Fri May 27 07:19:55 2011 +0200

    [TASK] Comment and non-functional changes
    
    ... appeared during bringing Fluid v4 and v5 in sync again
    
    Change-Id: I326663606a917ad84fa82a736a536ff77863a0b3

commit 967b86239e2459ce60938dbe42f0a66129942e1d
Author: Stefan Neufeind <*****@speedpartner.de>
Date:   Thu Aug 18 10:15:11 2011 +0200

    [BUGFIX] Make textfield view helper handle zero (not empty) values
    
    Values which are 0 (zero) are treated like but are not an empty string.
    They need to be handled as normal values (output to be shown in field).
    
    Thanks to Alexander Stehlik.
    
    Change-Id: I7e6f464b281261badd1cc521df3d0f10c4546408
    Resolves: #27938

commit fd09d197fa8886b97cb20aa9573f39cd08ce989e
Author: Bastian Waidelich <*****@typo3.org>
Date:   Thu Nov 10 18:27:58 2011 +0100

    [TASK] S*****@author annotations
    
    This backports three recent changes of the TYPO3.Fluid package:
    - R*****@license annotation from files (290f4f5)
    - Simplify license header in PHP files (14bacba)
    - D*****@author tags from source code (9c2e837)
    
    This should not contain any functional change!
    
    Change-Id: I9376dca4af78c4f0f82413011d115b8ad04634dd

commit ec3891d8d4e339d8319428211207e6201be9fd73
Author: Thomas Maroschik <*****@dfau.de>
Date:   Wed Oct 17 21:18:26 2012 +0200

    [TASK][WIP] Move non class code back to source files
    
    Change-Id: I620d2e61860142cdc89cc83474c95542799961c0

commit 554e8f890dcc0dd86a27518b58e2b54be26fd37e
Author: Thomas Maroschik <*****@dfau.de>
Date:   Wed Oct 17 22:20:17 2012 +0200

    [TASK] Namespace classes
    
    Change-Id: Ia7432e1c923826ed58206bca15fb94509adbd508

commit 9d13dedf017b614b834261b1bf5d4acb2201f1d4
Author: Alexander Schnitzler <*****@typovision.de>
Date:   Fri Nov 16 19:49:02 2012 +0100

    [CLEANUP] Replace FLOW3 with TYPO3 Flow
    
    Releases: 6.0
    Fixes: #43036
    Change-Id: I62df23587301b4cde3ddeae3686b34f54fe1182e
    Reviewed-on: http://review.typo3.org/16498
    Reviewed-by: Alexander Schnitzler
    Tested-by: Alexander Schnitzler

commit 9d46e6932d35c79bf87c96fa38b8e537c4192f23
Author: Alexander Schnitzler <*****@typovision.de>
Date:   Tue Nov 20 16:27:02 2012 +0100

    [CLEANUP] Adjust code to CGL and fix small namespace bugs
    
    * whitespaces, tabs and blank line issues
    * bool -> boolean
    * int -> integer
    * fix wrong namespace annotations
    
    Fixes: #43157
    Releases: 6.0
    Change-Id: I8397948e19248db029d8efd1555ee56e4982742d
    Reviewed-on: http://review.typo3.org/16619
    Reviewed-by: Helmut Hummel
    Tested-by: Helmut Hummel

commit 50d433bbde06b4b9eab146caea64d09239949e64
Author: Tymoteusz Motylewski <*****@gmail.com>
Date:   Sun Mar 3 18:53:42 2013 +0100

    [TASK] Sync CMS Fluid with Flow Fluid 1.1 (part2)
    
    This is the second part of a backport fluid from Flow.
    
    Change-Id: I96e47131414c50801ff7628508dc05d7d7b5e106
    Releases: 6.1
    Resolves: #44819
    Fixes: #45985
    Reviewed-on: https://review.typo3.org/18163
    Reviewed-by: Wouter Wolters
    Tested-by: Wouter Wolters
    Reviewed-by: Marc Bastian Heinrichs
    Tested-by: Marc Bastian Heinrichs

commit 745e6a6517967c0b2344e9dd0f764d37d3071e76
Author: Wouter Wolters <*****@wouterwolters.nl>
Date:   Sun Apr 28 23:44:28 2013 +0200

    [FEATURE] Add placeholder argument to VH for Textarea and Textfield
    
    Change-Id: I8c4cc22e10ce2991f48c32b7934bf01346f8aecf
    Resolves: #45960
    Releases: 6.2
    Reviewed-on: https://review.typo3.org/20281
    Reviewed-by: Wouter Wolters
    Tested-by: Wouter Wolters
    Reviewed-by: Helmut Hummel
    Reviewed-by: Stefan Neufeind
    Tested-by: Stefan Neufeind

commit 53cc9cd3e439a6dc49047c7d4545795f9dd9e8e2
Author: Anja Leichsenring <*****@ab-softlab.de>
Date:   Thu May 16 12:37:53 2013 +0200

    [BUGFIX] Remove second registration of argument 'placeholder'
    
    Feature #45960 introduced a second registration of the placeholder
    argument, causing the Extension Manager 'Get Extensions' function
    to throw an exception. The same is true for all extensions using the
    textfield viewhelper.
    
    This patch removes the second registration in the render function
    parameters list to use the same method in all viewhelpers.
    
    Resolves: #48250
    Related: #45960
    Releases: 6.2
    Change-Id: I25c6c1510c7a38a4a1946205189f0b65a3f4ffe1
    Reviewed-on: https://review.typo3.org/20824
    Reviewed-by: Philipp Gampe
    Tested-by: Philipp Gampe
    Reviewed-by: Wouter Wolters
    Tested-by: Wouter Wolters

commit e6e0b4f1488671a2cf69940d1287bd5ddd363947
Author: Tim Spiekerkoetter <*****@hdnet.de>
Date:   Sat Jul 6 12:35:35 2013 +0200

    [FEATURE] Added autofocus attribute to textfield and textarea
    
    The ViewHelpers f:form.textfield and f:form.textarea were lacking the
    HTML5 "autofocus" attribute. It is available for button, input and
    textarea. Now Fluid reflects this correctly by adding this attribute to
    the initializeArguments methods for TextareaViewHelper and
    TextfieldViewHelper.
    
    Resolves: #48689
    Releases: 6.2
    Change-Id: I00480dc4e76b2854dc0be36d150d32c7b432d93d
    Reviewed-on: https://review.typo3.org/21994
    Reviewed-by: Wouter Wolters
    Tested-by: Wouter Wolters
    Reviewed-by: Christian Kuhn
    Tested-by: Christian Kuhn

commit 77f29a3c69a7cbb27b34072754aa503bace6c9f1
Author: Christian Kuhn <*****@schwarzbu.ch>
Date:   Tue Oct 1 14:40:56 2013 +0200

    [TASK] Remove closing PHP tags
    
    Change-Id: Iaa92566c53301e49396fc9fb26b0b339c48d567b
    Resolves: #52360
    Releases: 6.2
    Reviewed-on: https://review.typo3.org/24212
    Reviewed-by: Christian Kuhn
    Tested-by: Christian Kuhn
    Reviewed-by: Ernesto Baschny
    Tested-by: Ernesto Baschny
    Reviewed-by: Anja Leichsenring
    Tested-by: Anja Leichsenring