View Issue Details

This bug affects 1 person(s).
 8
IDProjectCategoryView StatusLast Update
16124Bug reportsTheme editorpublic2021-08-12 08:46
Reportertpartner Assigned Toollehar  
PrioritynormalSeveritypartial_block 
Status closedResolutionfixed 
Product Version4.1.16 
Target Version4.1.17 
Summary16124: In custom question theme, cannot hide core attribute and set a default value
Description

In config.xml, I can hide core attributes with code like this:

<attribute>
<name>prefix</name>
<category>Display</category>
<inputtype></inputtype>
</attribute>

However, when I try to hide the attribute AND set a default value like this, the default value is not picked up (in this case, the question is always hidden).

<attribute>
<name>hidden</name>
<category>Display</category>
<inputtype></inputtype>
<default>0</default>
</attribute>

This is a regression as it worked in 3.x.

Sample survey and question theme attached.

Steps To Reproduce

In config.xml of the attached theme, I have commented out the code to hide the "hidden" attribute (lines 94-101). Un-comment that code block and you will see that the questions are hidden despite the fact that a value of 0 is set as default.

TagsNo tags attached.
Attached Files
cardSort.zip (417,263 bytes)
Card_Sort_for_4.x.lss (40,463 bytes)
Bug heat8
Complete LimeSurvey version number (& build)4.1.16
I will donate to the project if issue is resolvedNo
BrowserN/A
Database type & versionmysqlnd 5.0.12
Server OS (if known)Windows 10
Webserver software & version (if known)Apache/2.4.39 (Win64)
PHP Version7.3.7

Users monitoring this issue

There are no users monitoring this issue.

Activities

c_schmitz

c_schmitz

2021-01-14 12:08

administrator   ~61539

This sounds like you used a property to fake-hide an input field.
IMHO this rather should be a new input type like 'hidden', or: if the input type also is related to value validation rather an additional attribute property named "hidden".

tpartner

tpartner

2021-01-14 13:04

partner   ~61540

Yes, I used the only way that I know to hide the attribute. It was suggested by Louis. It is definitely sub-optimal as the parent divs and sibling labels are still rendered.

If there is better way I would be happy to test. Documentation is extremely limited.

I would love to see a "hidden" attribute property.

tpartner

tpartner

2021-01-14 13:13

partner   ~61541

...also, a method to hide entire categories would be cool. For example, I often use multiple-numerics without sliders or to render my own custom sliders so would like to hide the entire "Slider" category.

ollehar

ollehar

2021-01-22 10:53

administrator   ~61633

So what you want, tpartner, is to apply custom CSS to the question editor for a certain question theme?

ollehar

ollehar

2021-01-22 10:53

administrator   ~61634

Maybe we should add a feature to include custom JS that is loaded when a question theme is loaded in question editor? Then you could change the appearance anyhow you want.

DenisChenu

DenisChenu

2021-01-22 11:36

developer   ~61639

So what you want, tpartner, is to apply custom CSS to the question editor for a certain question theme?

Not oinly CSS : just don't send HTML

See

It is definitely sub-optimal as the parent divs and sibling labels are still rendered.

tpartner

tpartner

2021-01-22 11:39

partner   ~61640

Yes, loading custom JS and CSS when viewing/editing the custom question theme would do the trick, providing we could still set defaults for any attributes hidden with that JS/CSS.

DenisChenu

DenisChenu

2021-01-22 11:45

developer   ~61641

In my opinion :

  1. Need a core way to hide (mean not render and didn't update keep value)
  2. Need a solution to add custom css and js

With custom css and js : you can hack, but still an hack. To hide other label :

('#general-setting-help-other_replace_text&quot;).closest('.form-row').hide()… and in 4.5.0 : it don't work …

ollehar

ollehar

2021-01-22 12:12

administrator   ~61643

Last edited: 2021-01-22 12:17

Good point, Denis. Using element id is not stable long-term. A new XML tag, then, maybe? For <show>1</show>

&lt;attribute>
  bla bla bla
  &lt;show>1&lt;/show>
&lt;/attribute>

?

ollehar

ollehar

2021-01-22 12:13

administrator   ~61644

Good lord, Mantis is stupid with HTML tags...

tpartner

tpartner

2021-01-22 13:01

partner   ~61645

Last edited: 2021-01-22 13:01

A new XML tag, then, maybe? For <show>1</show>

Yes! :)

tpartner

tpartner

2021-01-22 13:02

partner   ~61646

...and JS and CSS so I can hide entire group elements?

ollehar

ollehar

2021-01-22 13:16

administrator   ~61647

Let's create a new ticker for JS/CSS support. I'm not sure how to apply CSS dynamically. JS is no problem.

tpartner

tpartner

2021-01-22 14:22

partner   ~61648

Thanks Olle.

DenisChenu

DenisChenu

2021-01-22 14:58

developer   ~61651

@tpartner : this mantis issue have a parent ?
We already discuss some month/year ago on the way to hide specific attribute , no ?

tpartner

tpartner

2021-01-22 18:10

partner   ~61652

@tpartner : this mantis issue have a parent ?
We already discuss some month/year ago on the way to hide specific attribute , no ?

Yeah, we did discuss it - https://bugs.limesurvey.org/view.php?id=14185

In my opinion, it was never resolved satisfactorily, or if it was, I can't find any documentation.

DenisChenu

DenisChenu

2021-01-22 18:23

developer   ~61653

In my opinion, it was never resolved satisfactorily, or if it was, I can't find any documentation.

Did you try in &lt;visible>0&lt;/visible> in QuestionTheme config ?

DenisChenu

DenisChenu

2021-01-22 18:32

developer   ~61654

Didn't work in 3.25.8 add input in a "model"

Updated version of autoComplete …

autoComplete.zip (365,861 bytes)
tpartner

tpartner

2021-01-22 20:57

partner   ~61655

Last edited: 2021-01-22 20:57

The visible property seems to work in 3.x but when using it in Version 4.4.0-RC4, the default property still does not work.

c_schmitz

c_schmitz

2021-03-15 15:08

administrator   ~63367

Last edited: 2021-03-15 15:10

Just to sum it up:

The property "visible" is used to hide attributes in the UI, but you want still use the property itself with a default value.

This works in 3.x (hide + default value)

In LS4 the default value does not work.

Correct?

tpartner

tpartner

2021-03-15 19:23

partner   ~63385

3.x:

  • Using &lt;inputtype>&lt;/inputtype>, the attribute is hidden in the back end and the default value is respected in the front end.

4.x:

  • Using &lt;inputtype>&lt;/inputtype> , the attribute is hidden in the back end but the default value is not respected in the front end.
  • Using &lt;visible>0&lt;/visible> has no effect.
16124_3.png (17,774 bytes)   
16124_3.png (17,774 bytes)   
16124_2.png (37,208 bytes)   
16124_2.png (37,208 bytes)   
cardSort-2.zip (48,704 bytes)
16124_1.png (33,767 bytes)   
16124_1.png (33,767 bytes)   
c_schmitz

c_schmitz

2021-03-26 14:49

administrator   ~63653

Thank you for the clarification.

Issue History

Date Modified Username Field Change
2020-04-10 18:06 tpartner New Issue
2020-04-10 18:06 tpartner Status new => assigned
2020-04-10 18:06 tpartner Assigned To => cdorin
2020-04-10 18:06 tpartner File Added: cardSort.zip
2020-04-10 18:06 tpartner File Added: Card_Sort_for_4.x.lss
2020-04-10 18:06 tpartner Description Updated
2020-04-10 18:07 tpartner Description Updated
2020-04-10 18:08 tpartner Description Updated
2020-04-10 18:08 tpartner Description Updated
2020-04-10 18:10 tpartner Description Updated
2020-04-10 18:10 tpartner Description Updated
2020-04-10 18:11 tpartner Description Updated
2020-04-10 18:12 tpartner Description Updated
2020-04-10 18:13 tpartner Description Updated
2020-04-10 18:13 tpartner Description Updated
2020-10-19 18:49 cdorin Assigned To cdorin =>
2020-10-19 18:49 cdorin Priority none => normal
2020-10-19 18:49 cdorin Status assigned => confirmed
2021-01-14 12:08 c_schmitz Note Added: 61539
2021-01-14 13:04 tpartner Note Added: 61540
2021-01-14 13:13 tpartner Note Added: 61541
2021-01-22 10:53 ollehar Note Added: 61633
2021-01-22 10:53 ollehar Note Added: 61634
2021-01-22 11:36 DenisChenu Note Added: 61639
2021-01-22 11:39 tpartner Note Added: 61640
2021-01-22 11:45 DenisChenu Note Added: 61641
2021-01-22 12:12 ollehar Note Added: 61643
2021-01-22 12:12 ollehar Note Edited: 61643
2021-01-22 12:13 ollehar Note Added: 61644
2021-01-22 12:17 ollehar Note Edited: 61643
2021-01-22 13:01 tpartner Note Added: 61645
2021-01-22 13:01 tpartner Note Edited: 61645
2021-01-22 13:02 tpartner Note Added: 61646
2021-01-22 13:16 ollehar Note Added: 61647
2021-01-22 14:22 tpartner Note Added: 61648
2021-01-22 14:58 DenisChenu Note Added: 61651
2021-01-22 18:10 tpartner Note Added: 61652
2021-01-22 18:23 DenisChenu Note Added: 61653
2021-01-22 18:32 DenisChenu Note Added: 61654
2021-01-22 18:32 DenisChenu File Added: autoComplete.zip
2021-01-22 20:57 tpartner Note Added: 61655
2021-01-22 20:57 tpartner Note Edited: 61655
2021-03-15 15:08 c_schmitz Note Added: 63367
2021-03-15 15:08 c_schmitz Assigned To => c_schmitz
2021-03-15 15:08 c_schmitz Status confirmed => feedback
2021-03-15 15:10 c_schmitz Note Edited: 63367
2021-03-15 15:10 c_schmitz Note Edited: 63367
2021-03-15 19:23 tpartner Note Added: 63385
2021-03-15 19:23 tpartner File Added: cardSort-2.zip
2021-03-15 19:23 tpartner File Added: limesurvey_survey_515183.lss
2021-03-15 19:23 tpartner File Added: 16124_3.png
2021-03-15 19:23 tpartner File Added: 16124_2.png
2021-03-15 19:23 tpartner File Added: 16124_1.png
2021-03-15 19:23 tpartner Status feedback => assigned
2021-03-26 14:49 c_schmitz Assigned To c_schmitz =>
2021-03-26 14:49 c_schmitz Status assigned => confirmed
2021-03-26 14:49 c_schmitz Note Added: 63653
2021-05-20 11:04 ollehar Working Git branch (developer only) => origin/feature/L41-T54-can-not-hide-attribute
2021-05-20 11:04 ollehar Working Git branch (developer only) origin/feature/L41-T54-can-not-hide-attribute => feature/L41-T54-can-not-hide-attribute
2021-05-20 11:59 ollehar Assigned To => ollehar
2021-05-20 11:59 ollehar Status confirmed => ready for testing
2021-07-21 17:24 ollehar Status ready for testing => resolved
2021-07-21 17:24 ollehar Resolution open => fixed
2021-08-12 08:46 c_schmitz Status resolved => closed