2016-02-16 98 views
-1

我正在使用經典ASP頁面。 此前在頁面中有一個複選框列表,我已將其更改爲多選列表框。現在,當我將其更改爲多選列表框時,所選值不會保存到正在保存的數據庫中,因爲它是複選框列表。經典ASP中未將列表框值存儲到數據庫

下面是從我的HTML頁面的代碼....

<div class="fields options secondary-category"> 
    <legend>Secondary Category</legend> 
    <p class="description">You may select up to two secondary categories in which you would like to be considered for an award (please hold the control key to select two categories).</p> 
    <select id="AwardsSecondaryCatagory" class="input-listbox" type="listbox" name="AwardsSecondaryCatagory" multiple="multiple" size="5"> 
    <option>Select an option</option> 
    <option name="financialexcellence" value="Financial Excellence">Financial Excellence</option> 
    <option name="operationalexcellence" value="Operational Excellence">Operational Excellence</option> 
    <option name="employeeexcellence" value="Employee Excellence">Employee Excellence</option> 
    <option name="customerexcellence" value="Customer Excellence">Customer Excellence</option> 
    <option name="Innovation" value="Innovation">Innovation</option> 
    <option name="Transformation" value="Transformation">Transformation</option> 
    </select> 
    <!-- 
    <div class="field opt"> 
    <input id="financialexcellence" class="input-checkbox" type="checkbox" value="Financial Excellence" name="financialexcellence"> 
    <label for="financialexcellence">Financial Excellence</label> 
    </div> 
    <div class="field opt"> 
    <input id="operationalexcellence" class="input-checkbox" type="checkbox" value="Opertional Excellence" name="operationalexcellence"> 
    <label for="operationalexcellence">Operational Excellence</label> 
    </div> 
    <div class="field opt"> 
    <input id="employeeexcellence" class="input-checkbox" type="checkbox" value="Employee Execellence" name="employeeexcellence"> 
    <label for="employeeexcellence">Employee Excellence</label> 
    </div> 
    <div class="field opt"> 
    <input id="customerexcellence" class="input-checkbox" type="checkbox" value="Customer Excellence" name="customerexcellence"> 
    <label for="customerexcellence">Customer Excellence</label> 
    </div> 
    <div class="field opt"> 
    <input id="Innovation" class="input-checkbox" type="checkbox" value="Innovation" name="Innovation"> 
    <label for="Innovation">Innovation</label> 
    </div> 
    <div class="field opt"> 
    <input id="Transformation" class="input-checkbox" type="checkbox" value="Transformation" name="Transformation"> 
    <label for="Transformation">Transformation</label> 
    </div> 
--> 
+0

@gaby如果[你不知道如何編輯](http://stackoverflow.com/revisions/35430824/2)不要打擾。爲什麼這是一個javascript代碼片段,其他的拼寫錯誤呢? – Lankymart

+0

你的ASP *('<% %>')*代碼? – Lankymart

+0

@Lankymart不要讓自己難堪。在投擲侮辱之前學習SO工具;) –

回答

1

選擇框值與select元素的名稱提交。

optionname屬性不使用(是無效的準確),讓所有選擇值被提交爲AwardsSecondaryCatagory

+0

我該如何限制列表框在HTML頁面中選擇不超過兩個值 – DineshKumarSingh

+1

@DineshKumarSingh答案很棒,但這不是開始詢問問題的地方,鼓勵你閱讀[問]之前發佈更多問題。 – Lankymart

0

您只需通過恢復你的數據:

<% 
AwardsSecondaryCatagory = request("AwardsSecondaryCatagory") 
%> 

然後,將它存儲在數據庫中!