zend-framework2view-helperszend-form2

ZendF 2 form view helper escapes attributes


i just started working with ZendF 2 and i noticed some wired behaviour when in Zend\Form. i tried to set 2 classes to the form instance using

$this->setAttribute('class', 'class1 class2');

then, in view i call

<?php echo $this->form()->openTag($form); ?>

the output is

<form class="class1&#x20;class2" id="login-form">

why is the space between class1 and class2 escaped? is this normal? as far as i tested it it works as expected.


Solution

  • Yes it is normal.

    &#x20; 
    

    is the HTML code for space. The browser interpreter will recognize it as a white space.

    In fact if you try to put that code in a comment here it will be interpreted as a white space.