Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

Changing the Question index from dropdown to buttons

More
5 years 2 months ago #179361 by ferdeng
Very nice, thank you so much!
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 2 months ago #179370 by DenisChenu

krosser wrote: BTW guys, I have figured out why the code from question_index_groups_buttons.twig was not working - buttons were not responsive. The original code was missing the href part from the url question_index_menu.twig.

You kidding ?

question_index_groups_buttons do BUTTON not LINK

And it work and was responsive …

Don't say silly things please

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
The topic has been locked.
  • krosser
  • krosser's Avatar Topic Author
  • Offline
  • Elite Member
  • Elite Member
More
5 years 2 months ago #179376 by krosser

DenisChenu wrote:

krosser wrote: BTW guys, I have figured out why the code from question_index_groups_buttons.twig was not working - buttons were not responsive. The original code was missing the href part from the url question_index_menu.twig.

You kidding ?

question_index_groups_buttons do BUTTON not LINK

And it work and was responsive …

Don't say silly things please


Well, try to copy/paste the code from question_index_groups_buttons.twig into layout_global.twig and see if it is responsive.
Code:
<div class="list-group index-button-full">
  <div class="list-group-item">
      <div class="h4 list-group-item-heading">{{ gT("Question index") }}</div>
  </div>
  {% for step, indexItem in aSurveyInfo.aQuestionIndex.items %}
    {% set templateClass = ''  %}
    {% if attribute(indexItem.stepStatus, 'index-item-unanswered') is defined and attribute(indexItem.stepStatus, 'index-item-unanswered') == true  %}
        {% set templateClass = templateClass ~ ' list-group-item-warning'  %}
    {% endif %}
    {% if attribute(indexItem.stepStatus, 'index-item-error') is defined and attribute(indexItem.stepStatus, 'index-item-error') == true   %}
        {% set templateClass = templateClass ~ ' list-group-item-danger'  %}
    {% endif %}
    {% if attribute(indexItem.stepStatus, 'index-item-current') is defined and attribute(indexItem.stepStatus, 'index-item-current') == true %}
        {% set templateClass = statusClass ~  ' disabled'  %}
    {% endif %}
    <button type="submit" name="move" value="{{ indexItem.step }}" class="list-group-item {{ indexItem.coreClass }} {{ templateClass }}" >{{ indexItem.text }}</button>
  {% endfor %}
</div>

I'm using the latest LS 3.22 hosted on LS servers, not installed locally.
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 2 months ago #179381 by DenisChenu

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
The topic has been locked.
  • krosser
  • krosser's Avatar Topic Author
  • Offline
  • Elite Member
  • Elite Member
More
5 years 2 months ago #179385 by krosser
Well, in any case, you need to direct those buttons to something, otherwise they won't lead anywhere. You click and nothing happens. It doesn't matter if it is a weblink (in case of the default dropdown menu) or button (which is actually a list-group in our case). You have to add href="#".

I'm using the latest LS 3.22 hosted on LS servers, not installed locally.
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 2 months ago - 5 years 2 months ago #179387 by DenisChenu
I think you need to learn HTML
button type="submit" : it's a action button submitting (in POST value) the data in the form …
It must be inside form.
Remind : i'm a PHP dev since more than 15 years, don't learn me my job …

See developer.mozilla.org/en-US/docs/Web/HTML/Element/button

An href is only available for a (link)

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
Last edit: 5 years 2 months ago by DenisChenu.
The topic has been locked.
  • krosser
  • krosser's Avatar Topic Author
  • Offline
  • Elite Member
  • Elite Member
More
5 years 2 months ago #179394 by krosser
Well, no need for personal insults, man. I have no time or intent for it. I just had to solve the problem.

I had to add this to the button to make it work. Without that it wouldn't submit.
Code:
data-limesurvey-submit='{{ indexItem.submit }}'
Code:
<button type="submit" name="move" value="{{ indexItem.step }}" data-limesurvey-submit='{{ indexItem.submit }}' class="list-group-item {{ indexItem.coreClass }} {{ templateClass }}" >{{ indexItem.text }}</button>

Adding <a href='{{ indexItem.url }}'> in front of the button created hyperlinks.
Code:
<a href='{{ indexItem.url }}'> <button type="submit" name="move" value="{{ indexItem.step }}" class="list-group-item {{ indexItem.coreClass }} {{ templateClass }}" > {{ indexItem.text }}</button>

I'm using the latest LS 3.22 hosted on LS servers, not installed locally.
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 2 months ago #179397 by DenisChenu
If you are OUT of form : us an a link with data-limesurvey-submit
If you are in form : use a buuton.

And NEVER put a button inside a a link.

You want you a link show like a button : use CSS : getbootstrap.com/docs/3.3/css/#buttons

It's not insult but you don't read what the other people write . I put this on the 1st answer : www.limesurvey.org/forum/can-i-do-this-w...-dropdown-to-buttons

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
The topic has been locked.
  • krosser
  • krosser's Avatar Topic Author
  • Offline
  • Elite Member
  • Elite Member
More
5 years 2 months ago #179424 by krosser
I read everything but sometimes it is very difficult to understand what you write. Sorry.

I'm using the latest LS 3.22 hosted on LS servers, not installed locally.
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 2 months ago - 5 years 2 months ago #179427 by DenisChenu

krosser wrote: I read everything but sometimes it is very difficult to understand what you write. Sorry.

It's the reason why i write : «I think you need to learn HTML» , it's clearly not an insult.

I don't give advice to a baker (about bread …), and if it's say something about bread : i don't say it false : It's his job, not mine.

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
Last edit: 5 years 2 months ago by DenisChenu.
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose