replace carriage returns client side

This commit is contained in:
bel
2020-05-30 08:58:44 -06:00
parent 9bd9c47895
commit e9c09f13d1
2 changed files with 16 additions and 2 deletions

View File

@@ -27,7 +27,14 @@ function upsert() {
function jsonifyForm(id) {
var form = document.getElementById(id)
var entries = new FormData(form).entries();
var json = Object.assign(...Array.from(entries, ([x,y]) => ({[x]:y})));
var json = Object.assign(...Array.from(
entries,
([x,y]) => ({
[x]:y
.replace(/\r\n/g, '\n')
.replace(/\r/g, '\n')
})
))
json.disabled = json.disabled == "false"
var s = JSON.stringify(json)
return s