View template control.view

Language: handlebars

Output a control named foo

{{control "foo"}}

Any valid changes to the control input’s value are propagated to the controlmodel.

Any validation errors are automatically displayed.

By default, the control uses the containing view's model for its value its schema from which is determines which settings apply, using the control’s name as the model/schema property.

All settings can be overridden by passing the corresponding attribute explicitly in the control helper.

Output a control in display mode

{{control "foo" display=true}}
{{control "foo" edit=false}}

Pass a value explicitly

{{control "foo" value=bar}}

Make the control’s value required

{{control "foo" required=true}}

Denote that the control can accept multiline input

{{control "foo" multiline=true}}

Set the control’s phrasekey

{{control "foo" phrasekey="fookey"}}

Set the control’s label

{{control "foo" label="Foo bar"}}
{{control "foo" label="foo.label"}} <- passing a phrasekey

Set the control’s note

{{control "foo" note="Foo is often followed by bar"}}
{{control "foo" note="foo.note"}} <- passing a phrasekey

See bauplan.control.view~initialize for more details on the phrasekey and how labels and notes are looked up

Setting the control-type explicitly

{{control "foo" control-type="payment-date-expiry"}}
{{control "foo" control-type="checkbox"}}
{{control "foo" control-type="select" options=optionsfoo}}
{{control "foo" control-type="password"}}

Setting the primitive explicitly

{{control "foo" control-primitive="number" }}

Setting the format explicitly

{{control "foo" control-format="email"}}

Any other attributes are passed to the control’s input

{{control "foo" attributes=attributes data-bar="baz"}}


The control helper is automatically converted into the correspnding view helper when the templates are loaded

The view template calls the specific control template wrapped in the control template


{{control "foo"}} -> {{view "control" control-name="foo"}}

Basic flow

    if edit
             notifications (errors etc)

If there is no such template for {{controltemplate}}.{{mode}}, then the text template for the corresponding mode is used

Name Type Attributes Description
controltemplate string

Name of control template

attributes object <optional>

Attributes to be passed on to specific control template