创建顶点时出现 Visualforce 错误:在选择选项上重复
好吧,我一直在绞尽脑汁试图弄清楚如何在不编写不必要的代码的情况下解决这个问题。
我有以下 Visualforce 代码,在保存时导致错误:
<select id="rec_count">
<apex:repeat value="{!pg}" var="selpg">
<option {!IF(selpg.value = selectedpgtxt, 'selected','')} value="{!selpg.value}" >
{!selpg.value}
</option>
</apex:repeat>
</select>
错误是: 错误:元素类型“option”后必须跟有属性规范“>”或“/>”。
显然,视觉强制解析器对选项标签没有 {!IF(selpg.value = selectedpgtxt, 'selected','')}< /代码>。
我已经尝试过等效的操作:
<option selected="" value="1">1</option>
<option selected="selected" value="2">2</option>
但是浏览器会考虑执行此操作所选择的所有选项。
Okay, I've been banging my head trying to figure out how to get around this issue without writing unnecessary code.
I have the following Visualforce code that is causing a error when saving:
<select id="rec_count">
<apex:repeat value="{!pg}" var="selpg">
<option {!IF(selpg.value = selectedpgtxt, 'selected','')} value="{!selpg.value}" >
{!selpg.value}
</option>
</apex:repeat>
</select>
The error is:
Error: Element type "option" must be followed by either attribute specifications, ">" or "/>".
Apparently the visual force parser is upset about a option tag not having a attribute for the {!IF(selpg.value = selectedpgtxt, 'selected','')}
.
I have tried the equivalent of:
<option selected="" value="1">1</option>
<option selected="selected" value="2">2</option>
However browser considers all of the options selected doing this.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
除非这被认为是不必要的代码,否则以下对我来说似乎非常简单。
视觉力:
顶点:
Unless this is considered unnecessary code, the following seems pretty straightforward to me.
Visualforce:
Apex: