mirror of
https://github.com/nottinghamtec/PyRIGS.git
synced 2026-01-16 21:12:13 +00:00
Merged in html-escape (pull request #50)
Escape HTML provided in form - issue #148
This commit is contained in:
@@ -11,6 +11,10 @@ function nl2br (str, is_xhtml) {
|
||||
return (str + '').replace(/([^>\r\n]?)(\r\n|\n\r|\r|\n)/g, '$1'+ breakTag +'$2');
|
||||
}
|
||||
|
||||
function escapeHtml (str) {
|
||||
return $('<div/>').text(str).html();
|
||||
}
|
||||
|
||||
function updatePrices() {
|
||||
// individual rows
|
||||
var sum = 0;
|
||||
@@ -101,8 +105,8 @@ $('body').on('submit', '#item-form', function (e) {
|
||||
}
|
||||
// update the table
|
||||
$row = $('#item-' + pk);
|
||||
$row.find('.name').html(fields.name);
|
||||
$row.find('.description').html(nl2br(fields.description));
|
||||
$row.find('.name').html(escapeHtml(fields.name));
|
||||
$row.find('.description').html(nl2br(escapeHtml(fields.description)));
|
||||
$row.find('.cost').html(parseFloat(fields.cost).toFixed(2));
|
||||
$row.find('.quantity').html(fields.quantity);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user