I am trying to make a simple login form. The username element
$this->add(array(
'name' => 'username',
'type' => 'Text',
'options' => array(
'label' => 'Username',
'placeholder' => 'user@domain.com'
),
));
The placeholder does not appear in the created form. Note that the 'label' appears correctly...
If I set it in controller code, it appears
$form->get('username')->setAttribute('placeholder',"user@domain.com");
Same problem for the button, I have to set
$form->get('submit')->setValue('Signin');
otherwise it just shows 'Add' for some reason...
Any ideas on what may be the problem?
Nevermind, newbie mistake. The placeholder should be in attributes apparently.
$this->add(array(
'name' => 'username',
'type' => 'Email',
'options' => array(
'label' => 'Username: ',
),
'attributes' => array(
'placeholder' => 'user@domain.com',
)
));
Problem of blindly following a blog post at -> http://programming-tips.in/zend-framework-2-login-with-zend-auth