redbox-mint / redbox

http://www.redboxresearchdata.com.au
GNU General Public License v2.0
5 stars 10 forks source link

Newlines replaced by "\n" in Notes field #36

Open marianneb opened 11 years ago

marianneb commented 11 years ago

There is a bug in the widget used in the notes form that causes carriage returns to be replaced by "\n".

To reproduce:

I have tested this on the current demo redbox install (1.6-RC01-SNAPSHOT). See http://demo.redboxresearchdata.com.au/redbox/default/detail/9cdb842db8449570159627376b225d17/ for a record where this has happened.

ozej8y commented 11 years ago

I have a fix for this issue.

At JCU we altered our description field to support many descriptions with a type and value. This is the only 'list' field in the framework that allows you to enter newlines '\n'.

In widgets2.js, the restore() processes each single instance field with this code.

                    t.val(data[v].replace(/\\n/g,"\n")).trigger("onDataChanged");

When processing all list fields the .replace(/\n/g, "\n") does not exist, so the '\n' is displayed on the screen instead of the newline character.

So here is my fix:

                    input.val(data[v].replace(/\\n/g,"\n")).trigger("onDataChanged");       line: 1634

This is based on the 1.6.1 release.