没有CFSelect的Coldfusion Multi-Select框 [英] Coldfusion Multi-Select box without CFSelect
问题描述
在不使用CFForm或CFSelect的情况下如何在Coldfusion中构建多选框?
How would one go about building a multiselect box in Coldfusion without using CFForm or CFSelect?
这是从数据库中提取值,因此它不仅是静态选择框,而且是动态的.
This is to pull values from a DB so its not just a static select box it is dynamic.
这是我第一次尝试使用ColdFusion进行编码,我一直都是.Net使用者,所以这对我来说是个变化.
This is my first time every trying to code in ColdFusion, I have always been a .Net person so this is a bit of a change for me.
之所以需要这个,是因为我被聘用到一个使用Coldfusion的部门工作,但是根据首席开发人员的告诉我,他们不使用CFForm,并且认为CFSelect必须位于CFForm内部需要一种不同的方式来做到这一点.
The reason why I am needing this is because I've gotten hired into a department at work that uses Coldfusion but from what the Lead developer told me is they do not use CFForm and seeing as how CFSelect requires to be inside CFForm I need a different way of doing this.
推荐答案
使用普通的旧HTML,例如:
Use plain old HTML, for example:
<cfquery name="qryUsers" datasource="datasourcename">
SELECT [User].[UserID], [User].[FirstName]
FROM [User]
</cfquery>
<cfoutput>
<form ...>
<select name="users" multiple="multiple">
<option value="">- please select -</option>
<cfloop query="qryUsers">
<option value="#UserID#">#FirstName#</option>
</cfloop>
</select>
</form>
</cfoutput>
这篇关于没有CFSelect的Coldfusion Multi-Select框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!