View Issue Details

This bug affects 1 person(s).
 6
IDProjectCategoryView StatusLast Update
12006Bug reportsTheme editorpublic2017-07-21 17:07
Reporterervit Assigned Toollehar  
PrioritynoneSeveritytweak 
Status closedResolutionwon't fix 
Product Version2.55.x 
Fixed in Version3.0.x 
Summary12006: Hiding empty help div in Default Theme template.js function
Description

The help text div is not always hidden in the Default Theme. The div <div class="row question-wrapper question-help-container"> is only fully hidden in short text questions. The error is in a JS function inside template.js functino "// Hide question help container if empty"

This code is wrong because it calls the wrong class (should be ('.question-help-container') ) and also checks its own inner HTML instead of the help-text div's inner HTML (should trim children's html).

This doesn't work:
// Hide question help container if empty
$('.questionhelp').each(function(){
$that = $(this);
if(!$.trim($that.html()))
{
$that.hide();
}
});

Steps To Reproduce

The easiest way to see this is to edit the order of {QUESTIONHELP} in the template question.pstpl: place it between the question text {QUESTION_TEXT} and question valid text {QUESTION_VALID_MESSAGE}, and then run a survey. In questions with no help text, which are also not short-text, there will be a blank line corresponding to the empty question-help-container div.

The correct code is below

Additional Information

This is the correct code:

// Hide question help container if empty
$('.question-help-container').each(function(){
$that = $(this);
if(!$.trim($that.children('div').html()))
{
$that.hide();
}
});

TagsNo tags attached.
Bug heat6
Complete LimeSurvey version number (& build)2.57.1+161205
I will donate to the project if issue is resolvedNo
BrowserFF 50
Database type & versionMySQL from GoDaddy
Server OS (if known)Linux
Webserver software & version (if known)GoDaddy shared hosting
PHP Version5.3

Users monitoring this issue

There are no users monitoring this issue.

Activities

DenisChenu

DenisChenu

2016-12-15 09:47

developer   ~42547

Completely rewritten on 3.0 version.

DenisChenu

DenisChenu

2016-12-15 11:05

developer   ~42548

And there are an issue in this sytem : exemple
question help : {self.NAOK} : empty at start, not shown when updated.

Think it must be a no fix for 2.5X

ollehar

ollehar

2016-12-20 17:50

administrator   ~42577

Will fix in 3.0.0 instead.

ollehar

ollehar

2016-12-20 17:51

administrator   ~42579

Also, I would prefer if things were hidden in PHP on server side, not on client. It looks better.

DenisChenu

DenisChenu

2016-12-20 19:05

developer   ~42581

hidden by css , and here : it's for pstpl file

<div class="help">{QUESTIONHELP}</div>

We can do
{if(is_empty(QUESTIONHELP),'','<div class="help">{QUESTIONHELP}</div>')} but not really needed i think.

Css
help::empty(display:none} do the tric.

Remind : we can have expression in help, if you hide in PHP : you need a css way too.

ollehar

ollehar

2016-12-21 11:00

administrator   ~42583

CSS sounds find.

I guess Twig might be able to branch on empty, too.

DenisChenu

DenisChenu

2016-12-21 11:05

developer   ~42584

Yes : we can remove it, ot really an issue. But even if remove it : we need another solution : then : css only seems the best no ?
Else : why do some uneeded PHP/twig test ? :)

ollehar

ollehar

2016-12-21 11:16

administrator   ~42586

Agree.

c_schmitz

c_schmitz

2017-07-21 17:07

administrator   ~44126

Version 3.0.0-beta.1 released

Issue History

Date Modified Username Field Change
2016-12-13 13:24 ervit New Issue
2016-12-15 09:47 DenisChenu Note Added: 42547
2016-12-15 11:05 DenisChenu Note Added: 42548
2016-12-20 17:50 ollehar Assigned To => ollehar
2016-12-20 17:50 ollehar Status new => resolved
2016-12-20 17:50 ollehar Resolution open => won't fix
2016-12-20 17:50 ollehar Fixed in Version => 3.0.x
2016-12-20 17:50 ollehar Note Added: 42577
2016-12-20 17:51 ollehar Note Added: 42579
2016-12-20 19:05 DenisChenu Note Added: 42581
2016-12-21 11:00 ollehar Note Added: 42583
2016-12-21 11:05 DenisChenu Note Added: 42584
2016-12-21 11:16 ollehar Note Added: 42586
2017-07-21 17:07 c_schmitz Note Added: 44126
2017-07-21 17:07 c_schmitz Status resolved => closed