Quantcast
Channel: Active questions tagged symfony4 - Stack Overflow
Viewing all articles
Browse latest Browse all 3925

How to add placeholder on an input in Symfony 4 form?

$
0
0

In a Symfony 4 form, I am trying to get a placeholder on my input. I tried the code below, but I get an error telling me it's not allowed. Any ideas how else I can achieve this?

$builder->add('firstname',     TextType::class,     ['label' => 'Vorname ', 'placeholder' => 'Your name',])

As suggested in the documentation I have also tried the code below, in this case I am not getting an error, but nothing is rendered.

$builder->add('firstname',     TextType::class,     ['label' => 'Vorname '],     ['attr' => ['placeholder' => 'Vorname ']])

Viewing all articles
Browse latest Browse all 3925

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>