안녕하십니까.document.GetElementByID ('input') 중에 DecodeForHTML. value = 'data [0]', 동적 배열 데이터
저는 보안 보고서 데이터를 추적하기 위해 사무실에서 개발 한 웹 응용 프로그램이 html 태그를 완화 필드에 추가 할 수있는 어려움을 겪고 있다고 오늘 배웠습니다. 이들은 데이터베이스에 varchar
으로 저장되며 완벽합니다. 그러나 페이지가 다시로드되고 표시를 위해 다시 읽혀지면 ColdFusion에서 해당 태그를 읽고 DataTable이 제대로 초기화되지 않으므로 오류가 발생합니다.
일부 재생 후 DataTable 초기화에 대해 <td>#EncodeForHTML(queryValue)#</td>
에 정착하여 표시되도록 허용합니다. 그러나 다음 단계는 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
다음과 같이 구현했습니다 : '