Using Symfony 3 and overridden FOSUserBundle's registration form, I have a readonly field:
->add('name', TextType::class, array('attr' => array('readonly' => true)))
For now, it appears as a textbox, but I would like it to appear as a text/label instead. I see nothing such as "LabelType". Is it possible to do this?
It look like you need customize the appearance of the textbox when it has the readonly
attribute. So the simple solution could be a single CSS style:
// style.css
input[readonly] {
border: none;
// more custom styles
}
I mean, there is no need to do something special in Symfony and could be useful for all input readonly form fields.