Coldfusion查询复选框

时间:2014-04-23 16:10:44

标签: jquery sql coldfusion

我需要帮助填充动态下拉选项的结果。因此,如果有人从下拉列表中选择学校,他们将看到学校列表,大多数是40,然后当点击学校时,"应用日期"它将为他们提供添加日期的选项。所以如果"应用日期"只检查然后他们可以输入日期。以下是我的问题

  1. 当有人点击特定学校时,您如何查询结果?让我们说字段名称是how_many_classrooms,投影仪等

  2. 如何使用复选框将下方的日期字段变灰并取消灰显,如果存在日期,则在查询中使用它?

  3. 有点贵宾在CF.任何帮助将不胜感激。感谢

    <!---javascript for keeping selected value (not working)--->
        <script type="text/javascript">
            function showSelection(theList) {
                var selectedValue = theList.options[theList.selectedIndex].value;
                document.getElementById('contentDiv').innerHTML = selectedValue;
            }
        </script>
    
    
                    <cfif isDefined('form.one')>
                        <cfset myschool = form.one>
                    </cfif>
    
        <!--- if school has been selected, save (not working) --->
                <cfparam name="myschool" default="">
                <cfif isDefined('form.one')>
                <cfset myschool = form.one>
                </cfif>
    
    
                <!---cfform --->
                <cfform method="POST" action="#cgi.script_name#" preserveData="true">
                <select name="one" required="yes" onchange="this.form.submit()">
                        <option>Select Type</option>
                        <option value="school"> School</option>
                        <option value="EID">EID</option>
                        <option value="principal">Principal Investor</option>
                        <option value="books">Sponsor Booksard</option>
                    </select>
                </cfform>
                <cfif structkeyexists(form, "one" ) and form.one neq "">
    
    
    
                    <!---All the queries for dynamic drop down --->     
    
    
    <cfswitch expression="#form.one#">
    <cfcase value="school">
            <cfquery name="schoollist" datasource="Employees" dbtype="ODBC">
                select school 
                from schools_view order by school
            </cfquery>
    
            <select name="schoollist" required="yes" onchange="this.form.submit()">
                <cfoutput query="schoollist">
                    <option value="#schoollist.school#" <cfif isDefined('form.one')><cfif form.one eq "#schoollist.school#">selected</cfif></cfif>>#schoollist.school#</option>
                </cfoutput>
            </select>
           </cfcase>
    
    
    
        <cfcase value="EID">
            <cfquery name="EIDlist" datasource="Employees" dbtype="ODBC">
                select EID, booksardname 
                from EID_Employees 
                order by EID
            </cfquery>
    
            <select name="EIDlist" required="yes" onchange="this.form.submit()">
                <cfoutput query="EIDlist">
    
                    <option value="#EIDlist.EID#">#EIDlist.EID# #EIDlist.booksardname#</option>
                </cfoutput>
            </select>
        </cfcase>
    
    
        <cfcase value="principal">
            <cfquery name="principallist" datasource="Employees" dbtype="ODBC">
                select employee_number, selectName from Employee_View
                order by selectname
            </cfquery>
    
            <select name="principalList" required="yes" onchange="this.form.submit()">
                <cfoutput query="principalList">
                    <option value="#principalList.selectname#">#principallist.selectName#</option>
                </cfoutput>
            </select>
        </cfcase>
    
        <cfcase value="books">
            <cfquery name="books" datasource="Employees" dbtype="ODBC">
                select distinct(customer_number), name 
                from sponsor_view
                order by name
            </cfquery>
    
            <select name="books" required="yes" onchange="this.form.submit()">
                <cfoutput query="books">
                    <option value="#books.name#">#books.name#</option>
                </cfoutput>
            </select>
        </cfcase>
    </cfswitch>
    <cfelse>
    
    </cfif>
    
    
        <tr><td>
            <cfform method="POST" action="#cgi.script_name#">
            <cfinput type="Checkbox" name="ControlName" value="Yes|No" onclick ="return true;">Check if limit by dates
            <tr><td><strong>Start of Period (mm/dd/yyyy):</strong><cfinput name="reportstart" type="text" maxlength="10" required="yes"  validate="regular_expression" pattern="[0-9]{2}[/\-][0-9]{2}[/\-][0-9]{4}$" message="Date should be in the form mm/dd/yyyy with leading zeros in month and day"></td></tr>
            <tr><td><strong>End of Period(mm/dd/yyyy):</strong><cfinput name="reportend" type="text" maxlength="10" required="yes" validate="regular_expression" pattern="[0-9]{2}[/\-][0-9]{2}[/\-][0-9]{4}$" message="Date should be in the form mm/dd/yyyy with leading zeros in month and day"  ></td></tr>
            <tr><td><input type="Submit" name="submit" value="Continue"></tr>
        </cfform>
    
    
    
    
    
    
        <tr><td>If not checked, show a drop down or radio list to select desired sort order: <li>No special sorting, will display items in report in the order in which they have been entered
    <li>Sort by Report Number, will display items in reportsorted using the Report Number
    <li>Sort by Report Due Date, will display items in report sorted by due date from earliest date to latest date
    </td></tr>
        <tr><td>Button to continue. </td></tr>
    </tr>
    
    </body>
    </html>
    

0 个答案:

没有答案