We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Custom value of submit button generated by Phalcon\Forms\Element\Submit

Hi all! Maybe it's very simple question, but I can't find the answer. I have form class LoginForm with Submit button like LoginForm in Vokuro example.

$t - is an object with translations for preferred language. So I need something like that:

<input type="submit" class="red-button" value="Log In">


<input type="submit" class="red-button" value="Увійти">

depends on lanuage, but it always like this:

<input type="submit" class="red-button" value="login">

This is my code:

$submit = new Submit('login', array(
    'class' => 'red-button',
    'value' => $t->Form->Login->Submit // This won't work! =(
$submit->setDefault($t->Form->Login->Submit); // This won't work too! =(

Also I tried this:

{{ form.render('login', ['value': t.Form.Login.Submit]) }}


There is a bug in 1.1.0 related to this, it's fixed in 1.2.0 but this version is still alpha, you can use the element name with the translation:

$submit = new Submit(t.Form.Login.Submit)

Thank you for your answer! I made it by raw HTML.

From one of my projects:


namespace Library\Form\Element;

class Submit extends \Phalcon\Forms\Element\Submit

    public function __construct($name, $parameters = array())
        parent::__construct($name, $parameters = array());
        $this->setAttribute('class', 'btn btn-primary"');

    public function render($attributes = array())
        return parent::render($attributes);


and in the form:

# ...
            new Submit('Login')
# ...