开发者

rendering zend form elements leaves a whitespace before

When I manually echo zend_form_elements (created through Form creation from an ini file), it appears that some whitespace is left before the actual element and I can't understand whats causing it or how to fix it. The direction is right to left btw. The screenshot describes best what I mean: (The 1 to 5 fields are form elements after removing the label decorator)

http://i52.tinypic.com/orqbkz.jpg

Here's the php code:

$templateElems = '<ol id=elemlist><li>'.$removeButton.'</li>';
        foreach ($elements as $elem){
        /*  $elem->label_style='';*/
            $elem->setLabel('');
            $elem->removeDecorator('label');
            $templateElems = $templateElems.'<li>'.$elem.'</li>';
            $table =  $table.'<th>'.$elem->getName().'</th>';

I would be most grateful if someone could at least tell me whats causing those whitespaces. Thanks in advance! Here's the HTML as requested:

   <input type=hidden id=oldnum name=num value=0></input>
<input type=hidden id=newnum name=num value=0></input>
<ol id=elemlist>
<li><img src="/images/delete.png" id=remitem name="remitem"></img></li>
<li><dd id="name-element"><input type="text" name="name" id="name" value=""></dd></li><li><dd id="text1-element"><input type="te开发者_JAVA技巧xt" name="text1" id="text1" value=""></dd></li><li><dd id="text2-element"><input type="text" name="text2" id="text2" value=""></dd></li><li><dd id="num1-element"><input type="text" name="num1" id="num1" value=""></dd></li>
</ol>
<table id=items border="0" cellspacing="1" cellpadding="0" class="list">
<tr><th>Remove Item</th><th>name</th><th>text1</th><th>text2</th><th>num1</th></tr>
</table>
<button id=addnew type="button">הוסף פריט</button></fieldset>
<dt id="submit-label">&#160;</dt><dd id="submit-element">
    <input type="submit" name="submit" id="submit" value="שלח"></dd></form></div>   
        <!--// End CONTENT-->


I would set the decorators to this: $elem->setDecorators(array('ViewHelper','Errors'));

this line will remove the tags that are created around your text box and it will remove the spaces.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜