Skip to main content

ui:emptyValueInput

View as Markdown

Renders the input a form control submits while it is empty.

A browser leaves an unchecked checkbox or a field without a value out of the form, so Extbase never learns that the property was cleared. This input submits '' under the name of the control, and the control disables it while it has a value.

<ui:emptyValueInput />

Place it in the template of a component whose context uses HasEmptyValueInputTrait, before the native input that holds the value: PHP keeps the last value under a name, so the real value wins. It renders nothing while the context has no emptyValueName.

A name that ends with [] is submitted without the brackets (tags, not tags[]), which Extbase maps to an empty array or ObjectStorage, where [''] would hold one empty entry. data-empty-value carries the full name, for the client to read an empty list.

Call syncEmptyValueInput() from the render() of the component to disable the input while the control has a value.

None