为什么 MyFaces/Trinidad 将我禁用的 inputTexts 渲染为 div?
看似简单的问题,但我在这里束手无策。
我有一个文件。它包含一个表格。其中包含一个子表单。其中包含一个只读文本字段。这是结构的相关部分:
<tr:document ...>
<tr:form ....>
<tr:subform ...>
<div ...><div ...>
<tr:panelGroupLayout>
<tr:panelFormLayout>
<tr:inputText id="selectedAmount"
label="#{...}"
value="#{...}"
disabled="true" />
</tr:panelFormLayout>
</tr:panelGroupLayout>
</div></div>
</tr:subform>
</tr:form>
</tr:document>
(... 上的任何属性都没有设置样式信息。)
为什么 MyFaces 为最里面的元素生成 div 而不是 input type="text"?我见过具有(显然)与此完全相同结构的表单,但没有此问题。
这是愚蠢且不可接受的原因是因为 div 在为空时不会显示为框而是显示为单行(由于没有内容且没有高度样式,边框会折叠)。通过 css 手动设置高度也是不可接受的,因为字体可能因计算机而异。我真的只是希望它始终呈现输入标签。
有什么想法吗?如果您想确认任何怀疑,请随时询问详细信息。数据太多了,我无法将所有内容都转储到这里。
Deceptively simple question, but I'm at my wits' end here.
I have a document. It contains a form. Which contains a subform. Which contains a read-only text field. Here's the relevant part of the structure:
<tr:document ...>
<tr:form ....>
<tr:subform ...>
<div ...><div ...>
<tr:panelGroupLayout>
<tr:panelFormLayout>
<tr:inputText id="selectedAmount"
label="#{...}"
value="#{...}"
disabled="true" />
</tr:panelFormLayout>
</tr:panelGroupLayout>
</div></div>
</tr:subform>
</tr:form>
</tr:document>
(none of the attributes on the ... are setting style information.)
Why is it that MyFaces produces for the innermost element a div rather than input type="text"? I've seen forms with (apparently) this exact same structure that didn't have this problem.
The reason why this is silly and unacceptable is because the div, when empty, doesn't show as a box but as a single line (the border collapses since there is no content and no height style). Manually setting a height via css isn't acceptable either, because the font may vary from computer to computer. I really just wanted it to always render an input tag.
Any ideas? Feel free to ask for details if you want to confirm any suspicion. There's too many data for me to just dump everything in here.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论