View Issue Details

This bug affects 1 person(s).
 6
IDProjectCategoryView StatusLast Update
09594Bug reportsExpression Managerpublic2015-05-08 09:16
Reporternwinter Assigned ToDenisChenu  
PrioritynormalSeverityminor 
Status closedResolutionfixed 
Product Version2.05+ 
Fixed in Version2.05+ 
Summary09594: EM nl2br() function doesn't work when content comes from current page
Description

When using EM's nl2br() function to show the contents of user input, with line breaks, it does not work if the expression is on the same page as the source. It does work if the source comes from a prior page.

Steps To Reproduce

Set up a group-by-group survey with a long text input question on group (page) 1. Add a text display to the same group that shows the contents of that question using {nl2br(question)}.

Add a second group that also includes the same text display.

TagsNo tags attached.
Attached Files
nl2br_problem.lss (13,857 bytes)
Bug heat6
Complete LimeSurvey version number (& build)150310
I will donate to the project if issue is resolvedNo
BrowserFirefox, Chrome
Database type & version178
Server OS (if known)x86_64-redhad-linux-gnu
Webserver software & version (if known)Apache/2.2.17
PHP Version5.3.8

Users monitoring this issue

There are no users monitoring this issue.

Activities

nwinter

nwinter

2015-04-02 13:06

reporter   ~31941

I think that the problem seems to happen here, and is noted in the code:

em_manager_helper.php
lines 7252-7257

// Note, this will destroy embedded HTML in the equation (e.g. if it is a report)
// Should be possible to use jQuery to remove just the LEMtailoring span, but not easy since done (the following doesn't work)
// _tmpval = $('#question801 .em_equation').clone()
// $(_tmpval).find('[id^=LEMtailor]').each(function(){ $(this).replaceWith(function(){ $(this).contents; }); })
$relParts[] = " $('#" . substr($jsResultVar,1,-1) . "').val($.trim(LEMstrip_tags($('#question" . $arg['qid'] . " .em_equation').html())));\n";

DenisChenu

DenisChenu

2015-04-02 13:22

developer   ~31942

Last edited: 2015-04-02 13:23

No, nl2br from phpjs last version fix the issue.
http://phpjs.org/functions/nl2br/

DenisChenu

DenisChenu

2015-04-03 12:32

developer   ~31943

Fix committed to master branch: http://bugs.limesurvey.org/plugin.php?page=Source/view&id=15067

DenisChenu

DenisChenu

2015-04-03 12:36

developer   ~31944

Fix committed to 2.06 branch: http://bugs.limesurvey.org/plugin.php?page=Source/view&id=15068

nwinter

nwinter

2015-04-03 14:36

reporter   ~31945

Ah, yes, I see now. Thank you - it's fixed and my limited understanding of LS is improved to boot!

c_schmitz

c_schmitz

2015-05-08 09:16

administrator   ~32121

2.05+ Build 150508 released

Related Changesets

LimeSurvey: master 678a3dee

2015-04-03 10:32:26

DenisChenu

Details Diff
Fixed issue 09594: EM nl2br() function doesn't work when content comes from current page
Dev: uodated to raw nl2br for phpjs
Dev: Todo : adding phpjs in third_party to allow easily update ?
Affected Issues
09594
mod - scripts/expressions/em_javascript.js Diff File

LimeSurvey: 2.06 175731d3

2015-04-03 10:35:49

DenisChenu

Details Diff
Fixed issue 09594: EM nl2br() function doesn't work when content comes from current page
Dev: updated to raw nl2br for phpjs
Dev: Todo : adding phpjs in third_party to allow easily update ?
Affected Issues
09594
mod - scripts/expressions/em_javascript.js Diff File

Issue History

Date Modified Username Field Change
2015-04-01 21:56 nwinter New Issue
2015-04-01 21:56 nwinter File Added: nl2br_problem.lss
2015-04-02 08:39 DenisChenu Assigned To => DenisChenu
2015-04-02 08:39 DenisChenu Status new => assigned
2015-04-02 13:06 nwinter Note Added: 31941
2015-04-02 13:22 DenisChenu Note Added: 31942
2015-04-02 13:23 DenisChenu Note Edited: 31942
2015-04-03 12:32 DenisChenu Changeset attached => LimeSurvey master 678a3dee
2015-04-03 12:32 DenisChenu Note Added: 31943
2015-04-03 12:32 DenisChenu Resolution open => fixed
2015-04-03 12:36 DenisChenu Changeset attached => LimeSurvey 2.06 175731d3
2015-04-03 12:36 DenisChenu Note Added: 31944
2015-04-03 12:36 DenisChenu Status assigned => resolved
2015-04-03 12:36 DenisChenu Fixed in Version => 2.05+
2015-04-03 14:36 nwinter Note Added: 31945
2015-05-08 09:16 c_schmitz Note Added: 32121
2015-05-08 09:16 c_schmitz Status resolved => closed