删除
我在更新表单“id=”tak_id”' 中有一个下拉列表,是从查询“takType”填充的。下拉框有“短信、聊天、推文”三个选项,具有三个不同的值“001,002,003”。
字段中的 SELECTED 值重复两次。如何使 SELECTED 值仅出现一次?
代码如下,
<cfselect name="tak_id" id="tak_id">
<cfoutput query="takType">
<option >select one</option>
<option value="#takType.tak_id#" <cfif takType.tak_id IS tak_id > selected </cfif> >
<cfswitch expression="#takType.tak_id#">
<cfcase value="01">SMS </cfcase>
<cfcase value="02">chat </cfcase>
<cfcase value="03">tweet </cfcase>
</cfswitch>
</option>
<option value="01" >SMS</option>
<option value="02" >chat</option>
<option value="03" >tweet</option>
</cfoutput>
</cfselect>
</td>
</tr>
非常感谢 弗朗西斯
I have an drop down in an Update form ‘id=”tak_id”’ being populated from an query”takType”. The drop down box has three options “sms, chat, tweet” with three different values”001,002,003”.
The SELECTED value in the field is being repeated twice.How can I make the SELECTED value appear only once?
The code is below
<cfselect name="tak_id" id="tak_id">
<cfoutput query="takType">
<option >select one</option>
<option value="#takType.tak_id#" <cfif takType.tak_id IS tak_id > selected </cfif> >
<cfswitch expression="#takType.tak_id#">
<cfcase value="01">SMS </cfcase>
<cfcase value="02">chat </cfcase>
<cfcase value="03">tweet </cfcase>
</cfswitch>
</option>
<option value="01" >SMS</option>
<option value="02" >chat</option>
<option value="03" >tweet</option>
</cfoutput>
</cfselect>
</td>
</tr>
thanks a lot
Fransis
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
为什么不将 cfif 语句移至三个硬编码选项中的每一个中?
Why not move the cfif statement into each of the three hard coded options?
我认为您的意思是仅将 cfoutputs 包裹在第一组周围,并删除底部的硬编码三个。像这样:
不过,可能有助于查看该查询的转储,因为这依赖于数据库中的这三个查询。
I think you mean to wrap the cfoutputs around the first group only and remove the hard coded three at the bottom. Like this:
Might help to see a dump of that query though, since this relies on those three being in the database.