私は Coldfusion 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の単なる制限ですか?
- これは正しく動作するはずですか、それとも完全に間違っていますか?
- これが機能しない場合は、このコードをかなり書き直す必要があります。データが投稿された後にこれを処理する方がコーディングが簡単です。フォームを修正すると手間がかかるので可能ですか?