Im having the following problem. If I try to use this code
$form = $this->createFormBuilder()
->add('code', 'integer', array(
'attr' => array('class' => 'login-input')
))
->add('einlösen', 'submit', array(
'attr' => array('class' => 'login-submit')
))
->getForm();
my browser doesnt show the ö in einlösen. If i remove the class attr it works. I thought this might be a css issue but the problem seems to be with symfony, since there is no matter what class I use the ö always gets mangled.
Another thing I realized is that if I do a cache clear the ö is there but as soon as i press the button once and reload the page its not showing up properly again.
asked Dec 11, 2014 at 10:43
Chaos
4151 gold badge5 silver badges11 bronze badges
-
1Can't you add a label to this field? Does your entity property has also an umlaut?Veve– Veve2014年12月11日 11:00:14 +00:00Commented Dec 11, 2014 at 11:00
1 Answer 1
Try to use the label option:
$this->createFormBuilder()
->add('submit', 'submit', array(
'label' => 'einlösen',
'attr' => array('class' => 'login-submit')
))
As an alternative you can set/overwrite the label in twig:
{{ form_widget(form.submit, { 'label': 'einlösen' }) }}
answered Dec 11, 2014 at 13:30
Rob
5,5011 gold badge35 silver badges34 bronze badges
Sign up to request clarification or add additional context in comments.
3 Comments
Veve
As he said in response to my comment, it's a button, it won't help him.
Rob
hmm the submitType has a label though... but well I generally would recommend switching language of the code to english and move definition of (german) labels to the frontend / translation files.
Chaos
it seems to work this way. Sorry Veve I misunderstood you there.
lang-php