Have you seen our video tutorials? Check 'em out!

Add attributes to input

luisfsd - 1 month ago

Using something like this:

{% set form = form('login').redirect(request_get('redirect')).get() %} {{ form.open|raw }} {{ form.fields.email.input|raw }} {{ form.close|raw }}

How can I add a placeholder to the email.input field?

Thanks.

ryanthompson - 1 month ago

It might be cleaner to simply use the input_name like this:

<input name="{{ form.fields.email.input_name }}" type="email" ... >

But you could also probably do something like this:

{{ form.fields.email.setAttributes({
    'key' => 'value',
    'moar' => 'values',
})|raw }}

khanhnguyen - 1 month ago

To supplement. ^^ A hash key must be followed by a colon (:)

{{ form.fields.email.setAttributes({
    'key' : 'value',
    'moar':'values',
})|raw }}