良い午後。document.GetElementByID( 'input')中のDecodeForHTML。値= 'data [0]'、動的配列データ
セキュリティレポートのデータを追跡するために私が開発したWebアプリケーションが、軽減フィールドにhtmlタグを追加することが困難であることを今日知った。これらはvarchar
としてデータベースに保存されますが、これは完璧です。ただし、ページがリロードされ、表示のために再度読み込まれると、ColdFusionでこれらのタグが読み込まれ、DataTableが正しく初期化されなくなるため、エラーが発生します。
いくつか再生した後、私は<td>#EncodeForHTML(queryValue)#</td>
にDataTable初期化のために解決しました。ただし、次のステップでは、DataTableの行データをクリックして、行の変更をデコードするために使用しているポップアップ入力に移動します。私がそれを今のまま残すと、これは下にあります。ポップアップがエンコードされたデータで開き、読みにくいです。出力の有無にかかわらず、DecodeForHTML(data[#])
を使用しようとしました。内部出力では、行をクリックするまで配列が作成されず、出力がないと構文エラーが発生するため、ページのロード時にデータが定義されていないというエラーが発生します。
私のポップアップで<textarea>
に表示すると、この文字列をどのようにデコードすることができますか?
DataTableを作成コード:
<div id="allFindings" style="max-height:50%">
<table id="dt_table_findings" class="display" style="table-layout:fixed; width:100%; font:calibri; font-size:11px; text-align:left;">
<thead>
<tr>
<th style="width:4%">Task Num</th>
<th style="width:5%">App</th>
<th style="width:5%">Priority</th>
<th style="width:5%">Vuln ID</th>
<th style="width:7%">Task</th>
<th style="width:5%">Status</th>
<th style="width:5%">Category</th>
<th>Document</th>
<th>Reasoning</th>
<th>Mitigation</th>
<th>Resources</th>
<th>Comments</th>
<th style="width:5%">Milestone Date</th>
<th style="width:5%">Follow-Up Date</th>
<th style="width:6%">Planned Completion</th>
<th style="width:5%">Closed</th>
<th style="width:5%">Last User</th>
</tr>
</thead>
<tbody>
<!---Fill datatable with Findings--->
<cfloop query="#findingsQuery#">
<tr style="">
<td>#TASK_NUM#</td>
<td>#APPLICATION#</td>
<td>#PRIORITY#</td>
<td>#VULN_ID#</td>
<td>#TASK#</td>
<td>#STATUS#</td>
<td>#TASK_CATEGORY#</td>
<td>#DOCUMENT#</td>
<td>#REASONING#</td>
<td>#EncodeForHTML(MITIGATION)#</td>
<td>#RESOURCES#</td>
<td>#COMMENTS#</td>
<td>#MILESTONE_DATE#</td>
<td>#FOLLOWUP_DATE#</td>
<td>#PLANNED_COMPLETION#</td>
<td>#CLOSED#</td>
<td>#LAST_USER#</td>
</tr>
</cfloop>
</tbody>
</table>
</div>
ポップアップ本部:
<div id="edit_findings" class="modal" style="min-width:550px;">
<cfform id="form_updateFindings">
<!---Hidden Popup Identifier for Submit Page--->
<cfinput type="hidden" name="view" id="view" value="findings">
<!--- Hidden Task Num --->
<cfinput type="hidden" name="h_taskNum" id="h_taskNum" />
<!---Shown Task Number--->
<p><label>Task Num: </label>
<cfinput type="text" name="taskNum" id="taskNum" disabled="disabled" /></p>
<!---Shown Application Name--->
<p><label>App: </label>
<cfinput type="text" name="app" id="app" /></p>
<!---Shown Priority--->
<p><label>Priority: </label>
<cfinput type="text" name="priority" id="priority" /></p>
<!---Shown Vulnerability ID--->
<p><label>Vuln ID: </label>
<cfinput type="text" name="vuln_id" id="vuln_id" /></p>
<!---Shown Task--->
<p><label>Task: </label>
<cfinput type="text" name="task" id="task" size="45" /></p>
<!---Shown Status--->
<p><label>Status: </label>
<cfinput type="text" name="status" id="status" /></p>
<!---Shown Category--->
<p><label>Category: </label>
<cfinput type="text" name="category" id="category" /></p>
<!---Shown Document Location--->
<p><label>Document: </label>
<cfinput type="text" name="document" id="document" size="45" /></p>
<!---Shown Resources--->
<p><label>Resources: </label>
<cfinput type="text" name="resources" id="resources" size="45" /></p>
<!---Shown Reasoning Box--->
<p><label>Reasoning: </label>
<textarea name="reasoning" id="reasoning" cols="35" rows="5"></textarea></p>
<!---Shown Mitigation Box--->
<p><label>Mitigation: </label>
<textarea name="mitigation" id="mitigation" cols="35" rows="5"></textarea></p>
<!---Shown Milestone Date Box--->
<p><label>Milestone Date: </label>
<textarea name="milestone" id="milestone" cols="35" rows="5"></textarea></p>
<!---Shown Comments Box--->
<p><label>Comments: </label>
<textarea name="comments" id="comments" cols="35" rows="5"></textarea></p>
<!---Shown Follow Up Date--->
<p><label>Follow-Up Date: </label>
<cfinput type="text" name="followup" id="followup" /></p>
<!---Shown Planned Completion--->
<p><label>Planned Completion: </label>
<cfinput type="text" name="plannedcomplete" id="plannedcomplete" /></p>
<!---Shown Closed--->
<p><label>Closed: </label>
<cfinput type="text" name="closed" id="closed" /></p>
<!---Shown Last User--->
<p><label>Last User: </label>
<cfinput type="text" name="lastuser" id="lastuser" disabled="disabled"/></p>
<br />
<!---Submit Button for Update Query--->
<cfinput type="button" class="btn" id="submitEditFindings" name="submitEditFindings" value="Submit" onClick="fn_updFindings();">
</cfform>
</div>
DataTableの初期化スクリプトと行をクリックアクション:
$(document).ready(function() {
var table = $('#dt_table_findings').DataTable({
"bLengthChange": false,
"pageLength": 10,
"dom": 'frti<"toolbar">p',
initComplete: function(){
$("div.toolbar").html('<input type="button" name="addButton" class="add-new-button" onclick="fn_OpenModal()"><input type="submit" name="downButton" class="download-button">');
}
});
<!--- Actions on Datatable Row Click --->
$('#dt_table_findings tbody').on('dblclick', 'tr', function() {
var data = table.row(this).data();
<!--- Set hidden variables for popup
alert(data);--->
document.getElementById('h_taskNum').value = data[0];
document.getElementById('taskNum').value = data[0];
document.getElementById('app').value = data[1];
document.getElementById('priority').value = data[2];
document.getElementById('vuln_id').value = data[3];
document.getElementById('task').value = data[4];
document.getElementById('status').value = data[5];
document.getElementById('category').value = data[6];
document.getElementById('document').value = data[7];
document.getElementById('comments').value = data[11];
document.getElementById('reasoning').value = data[8];
document.getElementById('mitigation').value = data[9];
document.getElementById('resources').value = data[10];
document.getElementById('milestone').value = data[12];
document.getElementById('followup').value = data[13];
document.getElementById('plannedcomplete').value = data[14];
document.getElementById('closed').value = data[15];
document.getElementById('lastuser').value = data[16];
<!--- Show popup --->
$('#edit_findings').modal();
});
});
これを使うことができます。代わりに、私は< >を二重引用符または一重引用符で置き換えることは、それらの内部のすべてを完全に削除するよりも良いでしょう。緩和計画では、変更が必要なタグを指定することは重要ですが、完全なコード形式である必要はありません。あなたのご意見ありがとうございます! – danninta
私はこれを '#REReplaceNoCase(除外、 "<|>"、 "'"、 "ALL")# 'と実装しました。これは完全に機能し、問題は解決されました。あなたがあなたの答えを編集したいなら、私はそれを受け入れます! – danninta