我正在使用Coldfusion MX7,並具有可以將幾個元素動態添加到表單的基本表單。它們被賦予相同的名稱,並且都是複選框。形式的例子如下:使用CF無法訪問的表單元素MX7
<form action="index.cfm?action=index.report" method="post" id="reportForm">
<div class="report my">
<ul class="connectWith ui-sortable" id="fieldListSelect" aria-disabled="false">
<li class="field" id="field_profileFn" style="">
<a class="action" id="action_profileFn" href="index.cfm?action=index.filter.profileFn" style="display: block; ">filter</a>
<label for="profileFn">First Name</label>
<input type="checkbox" name="reportItem" id="profileFn" value="profileFn">
</li>
<li class="field" id="field_profileSn" style="">
<a class="action" id="action_profileSn" href="index.cfm?action=index.filter.profileSn" style="display: block; ">filter</a>
<label for="profileSn">Surname</label>
<input type="checkbox" name="reportItem" id="profileSn" value="profileSn">
</li>
<li class="field" id="field_contactDate" style="">
<a class="action" id="action_contactDate" href="index.cfm?action=index.filter.contactDate" style="display: block; ">filter</a>
<label for="contactDate">Contact date</label>
<input type="checkbox" name="reportItem" id="contactDate" value="contactDate">
</li>
</ul>
</div>
</form>
一旦表單被提交我打通cfdump如下:
<table class="cfdump_struct">
<tr><th class="struct" colspan="2" onClick="cfdump_toggleTable(this);" style="cursor:hand;" title="click to collapse">struct</th></tr>
<tr><td class="struct" onClick="cfdump_toggleRow(this);" style="cursor:hand;" title="click to collapse">CONTACTDATE_FROM</td>
<td> Thu May 19 2011 00:00:00 GMT+0100 (GMT Daylight Time) </td></tr>
<tr><td class="struct" onClick="cfdump_toggleRow(this);" style="cursor:hand;" title="click to collapse">CONTACTDATE_TO</td>
<td> Thu May 19 2011 00:00:00 GMT+0100 (GMT Daylight Time) </td></tr>
<tr><td class="struct" onClick="cfdump_toggleRow(this);" style="cursor:hand;" title="click to collapse">FIELDNAMES</td>
<td> REPORTITEM[],CONTACTDATE_FROM,CONTACTDATE_TO </td></tr>
<tr><td class="struct" onClick="cfdump_toggleRow(this);" style="cursor:hand;" title="click to collapse">REPORTITEM[]</td>
<td> profileFn,profileSn,contactDate </td></tr>
</table>
元素REPORTITEM []報道,並試圖訪問這個作爲可變我得到:
<cfset testing = form.reportItem[]>
Invalid CFML construct found on line 6 at column 50.
在試圖訪問的方式有變我希望我得到如下:
<cfset testing = form.reportItem>
Element REPORTITEM is undefined in FORM.
我已經繼承了這個代碼,它必須以前有效。 Coldfusion尚未升級(顯然仍然是CF 7),沒有其他任何改變了我能想到的服務器端。
我的問題:
- 這僅僅是一個CF7的限制嗎?
- 這應該是正確的還是完全錯誤?
- 如果這不起作用,我將不得不重寫這段代碼,在數據發佈後處理這些代碼會更容易編寫代碼。修改表單會更加努力,所以可能嗎?
終於在星期五失蹤後回到工作,因爲我的女兒有水痘,並能夠測試。工作絕對的對待。 – bjammin666 2011-05-23 08:46:47