Add attributes to input
Created 7 years ago by luisfsd

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  —  7 years 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  —  7 years ago

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

{{ form.fields.email.setAttributes({
    'key' : 'value',
    'moar':'values',
})|raw }} 
lckamal  —  7 years ago

It is not working for relationship field type select.