当我创建一个Zend File Form元素并将其放置在我的视图中时,组件会被搁置。如图所示,https://i.stack.imgur.com/WJjB5.png。正如您在图片上看到的,输入字段已经跳下或标签上升。我不明白为什么会这样,请给我建议!
下面是我生成这个元素的代码。
private function _getFileElement($category = 0) {
if ($category == 1) {
$fileElement = $this->createElement('file', 'file_email');
} else if ($category == 2) {
$fileElement = $this->createElement('file', 'file_letter');
} else {
$fileElement = $this->createElement('file', 'file');
}
$fileElement->setLabel('Egen mall')
->setAttrib('style', 'width:300px;')
->setDestination('/tmp/');
$fileElement->addValidator('Count', false, 1);
return $fileElement;
}
这是我稍后添加的。
致问候,
Gabriel Paulsson
我相信zend在dd和dt标记中正确地输出了表单。我认为浏览器会解释文件标记并使其看起来像这样。不过我可能错了。您可能应该查看表单装饰器。