Coldfusion Multi-Select box without CFSelect

丶灬走出姿态 提交于 2020-03-26 05:17:22

问题


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.

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.

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.


回答1:


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>


来源:https://stackoverflow.com/questions/11715600/coldfusion-multi-select-box-without-cfselect

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!