Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

Can't override the type attribute for Phalcon\Forms\Element\Text

When I do:

$email = new Text( 'email' );
$email->setAttribute( 'type', 'email' );

It gets rendered as:

<input type="text" id="email" name="email" />

Even though I explicitly set the type attribute to "email". Is there a way to accomplish this without writing my own element class?

edited May '15

Hi, you have to use Phalcon\Forms\Element\Email instead of Phalcon\Forms\Element\Text

use Phalcon\Forms\Element\Email;
$email = new Email( 'email' );

Blargh, how did I not fond that in the docs? Thanks jcheron.