How to add HTML to form submit button?
- wise
- Member | 161
Hi guys,
i want to add some html to submit button.
If i try it with other form elements, it's ok:
<?php
$star = Html::el('span')->addAttributes(array('class' => 'red'))->setText('*');
$form->addText('name', Html::el('')->setText('Jméno')->add($star))
?>
but in submit i get this: https://www.dropbox.com/…13.25.09.png
<?php
$icon = Html::el('i')->addAttributes(array('class' => 'icon-double-angle-right icon-large'));
$form->addSubmit('submit', Html::el('')->setText('ODESLAT')->add($icon));
?>
Thanks in advance.
- jiri.pudil
- Nette Blogger | 1035
I guess that's correct behavior, since in case of submit button you're setting its “value” attribute, not the markup (label). You can access and modify the markup of the button itself though.

- petr.pavel
- Member | 535
You could try adding the classes to the submit button itself.
$form->addSubmit('submit', 'ODESLAT')
->getControlPrototype()->class('icon-double-angle-right icon-large');
RSS feed
Topic closed