Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing characters when pasting survey questions #29

Open
clifrjohnson opened this issue Jan 14, 2020 · 2 comments
Open

Missing characters when pasting survey questions #29

clifrjohnson opened this issue Jan 14, 2020 · 2 comments

Comments

@clifrjohnson
Copy link

When pasting in question information into the Multilingual tool I found that a single character is being removed in certain places if the text is preceded by CRLF's. For instance, if you were to post in text such as:

@p1000lang{"Spanish":" Test.

La test2.

Asegúrese test3."}

The "L" and the "A" were both captured on the second and third lines due to the code on line 175 of the multilingual_setup.js file,
questions = JSON.parse(tags[id].replace('p1000lang','').replace(/\n([^@])/g, "<br>"));

Changing the code to match the other instances with the replace having the "
$1" as on lines 161 and 275 will resolve the issue, however, I just want to make sure that this code is not trying to prevent something that I have not encountered yet.

Additionally, if the intent is to remove new line characters shouldn't the regex be greedy,
.replace(/\n+([^@])/g, "<br>$1"));

@smartinkc
Copy link
Owner

smartinkc commented Jan 14, 2020

I not 100% sure if it's on purpose or not. I will take a look when I have a minute. I do know if you put a <br> tag in the field annontation (with or without the multilingual module enabled), REDCap replaces it with a carriage return. It's possible that it has something to do with the data dictionary, so if you do test it, take a look at the data dictionary after your changes and see if it gets uploaded or not. I'll try and take a look this week.

@weip
Copy link

weip commented Jan 7, 2021

I have the same issue. When saving Hello<br><br>world as my first question, then I go back editing this field, it shows Hello<br><br>orld. Looks like $1 is fixing the issue, but I don't know why.

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants