- Messages : 28
- Remerciements reçus 0
Array with large text fields
- nique
-
Auteur du sujet
- Hors Ligne
- Junior Lime
-
Réduire
Plus d'informations
il y a 8 mois 1 semaine #169901
par nique
COM_KUNENA_MESSAGE_CREATED_NEW
I found this great thread with super helpful script by tpartner!
www.limesurvey.org/forum/can-i-do-this-w...-text-comment-fields
I am trying to edit the script slightly but am struggling.
On one page, I am presenting single arrays per question. This is just due to the nature of the question and how the researcher wants to present it.
I want to have each question/array have its own comment box - which includes some text specific to the question.
Unfortunately, this script picks up on all the comment boxes on the page and presents all 3, rather than just the one I want.
I am attaching my question group as an example of my survey -
There will be more questions per page as well. Hope this makes sense and I can get some help.
Thanks in advance.
www.limesurvey.org/forum/can-i-do-this-w...-text-comment-fields
I am trying to edit the script slightly but am struggling.
On one page, I am presenting single arrays per question. This is just due to the nature of the question and how the researcher wants to present it.
I want to have each question/array have its own comment box - which includes some text specific to the question.
Unfortunately, this script picks up on all the comment boxes on the page and presents all 3, rather than just the one I want.
I am attaching my question group as an example of my survey -
There will be more questions per page as well. Hope this makes sense and I can get some help.
Thanks in advance.
Connexion ou Créer un compte pour participer à la conversation.
- holch
-
- Hors Ligne
- LimeSurvey Community Team
-
Réduire
Plus d'informations
- Messages : 7004
- Karma: 253
- Remerciements reçus 1349
il y a 8 mois 1 semaine #169903
par holch
I'm not a LimeSurvey GmbH member. I answer at the LimeSurvey forum in my spare time. No support via private message.
Some helpful links: Manual (EN) | Question Types | Workarounds
COM_KUNENA_MESSAGE_REPLIED_NEW
Ideally you always provide a .lss file that the forum helpers can just import and play with (of course stripped of everything unnecessary and focused on the problems in question). Otherwise the forum helpers have to create a survey and then import your question group, which also will only work, if the base language is right, etc.
I'm not a LimeSurvey GmbH member. I answer at the LimeSurvey forum in my spare time. No support via private message.
Some helpful links: Manual (EN) | Question Types | Workarounds
Connexion ou Créer un compte pour participer à la conversation.
- nique
-
Auteur du sujet
- Hors Ligne
- Junior Lime
-
Réduire
Plus d'informations
- Messages : 28
- Remerciements reçus 0
il y a 8 mois 1 semaine #169904
par nique
Apologies. LSS file attached with an example of one group of questions.
COM_KUNENA_MESSAGE_REPLIED_NEW
Apologies. LSS file attached with an example of one group of questions.
Connexion ou Créer un compte pour participer à la conversation.
- tpartner
-
- Hors Ligne
- LimeSurvey Community Team
-
Réduire
Plus d'informations
- Messages : 7813
- Karma: 618
- Remerciements reçus 2292
il y a 8 mois 6 jours #169910
par tpartner
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
COM_KUNENA_MESSAGE_REPLIED_NEW
When providing examples, please give them in .lss (survey export) format so we don't have to spend time creating surveys.
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Connexion ou Créer un compte pour participer à la conversation.
- nique
-
Auteur du sujet
- Hors Ligne
- Junior Lime
-
Réduire
Plus d'informations
- Messages : 28
- Remerciements reçus 0
il y a 8 mois 6 jours #169911
par nique
COM_KUNENA_MESSAGE_REPLIED_NEW
Yep. Holch pointed this out and the reply there has the lss file.
Connexion ou Créer un compte pour participer à la conversation.
- tpartner
-
- Hors Ligne
- LimeSurvey Community Team
-
Réduire
Plus d'informations
- Messages : 7813
- Karma: 618
- Remerciements reçus 2292
il y a 8 mois 6 jours #169922
par tpartner
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
COM_KUNENA_MESSAGE_REPLIED_NEW
What is your LimeSurvey version?
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Connexion ou Créer un compte pour participer à la conversation.
- nique
-
Auteur du sujet
- Hors Ligne
- Junior Lime
-
Réduire
Plus d'informations
- Messages : 28
- Remerciements reçus 0
il y a 8 mois 6 jours #169930
par nique
COM_KUNENA_MESSAGE_REPLIED_NEW
2.59.
Connexion ou Créer un compte pour participer à la conversation.
- tpartner
-
- Hors Ligne
- LimeSurvey Community Team
-
Réduire
Plus d'informations
- Messages : 7813
- Karma: 618
- Remerciements reçus 2292
il y a 8 mois 6 jours - il y a 5 mois 3 semaines #169932
par tpartner
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
COM_KUNENA_MESSAGE_REPLIED_NEW
In that case, this should work:
Working survey attached:
<script type="text/javascript" charset="utf-8">
$(document).ready(function() {
// Identify the questions
var qArray = $('#question{QID}');
var arrayLength = $('tr.answers-list', qArray).length;
var qComments = qArray.nextAll('.text-long:lt('+arrayLength+')');
// Add some classes
qArray.addClass('array-with-comments-question');
$(qComments).each(function(i) {
$(this).addClass('comments-question index-{SGQ}-'+i);
});
// Insert the comments buttons
$('table.questions-list col', qArray).removeAttr('width');
$('table.questions-list thead tr', qArray).append('<td />');
$('tr.answers-list', qArray).each(function(i) {
$(this).append('<td><button class="comment-button" type="button" data-index="{SGQ}-'+i+'">Comments</button></td>');
});
// Put the comments questions into modal dialogs
$(qComments).dialog({
autoOpen: false,
width: 620,
modal: true,
resizable: false,
draggable: false,
closeOnEscape: true
});
// Click events for comments buttons
$('.comment-button').click(function() {
var thisIndex = $(this).attr('data-index');
$('.comments-question.index-'+thisIndex).dialog('open');
});
// Interrupt the Next/Submit function (to put comments back in the form)
$('#limesurvey').submit(function (e) {
qComments.hide();
$('#limesurvey').append(qComments);
});
});
</script>
Working survey attached:
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Last edit: il y a 5 mois 3 semaines by tpartner.
Les utilisateur(s) suivant ont remercié: nique
Connexion ou Créer un compte pour participer à la conversation.
- nique
-
Auteur du sujet
- Hors Ligne
- Junior Lime
-
Réduire
Plus d'informations
- Messages : 28
- Remerciements reçus 0
il y a 6 mois 3 semaines #171901
par nique
COM_KUNENA_MESSAGE_REPLIED_NEW
Apologies for my delayed thanks. This was a very rushed project and your code saved me greatly so thanks!
Unfortunately, I have just come to realise that none of the comments boxes are saving the responses. I can enter text no issue, but nothing is saved in the data file.
I am not sure what the issue could be so I have attached the .lss file so you can see what one aspect of my survey looks like and hopefully help with the bug.
Unfortunately, I have just come to realise that none of the comments boxes are saving the responses. I can enter text no issue, but nothing is saved in the data file.
I am not sure what the issue could be so I have attached the .lss file so you can see what one aspect of my survey looks like and hopefully help with the bug.
Connexion ou Créer un compte pour participer à la conversation.
- tpartner
-
- Hors Ligne
- LimeSurvey Community Team
-
Réduire
Plus d'informations
- Messages : 7813
- Karma: 618
- Remerciements reçus 2292
il y a 6 mois 2 semaines - il y a 5 mois 3 semaines #171915
par tpartner
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
COM_KUNENA_MESSAGE_REPLIED_NEW
That's because you have changed the variable name "qComments" to "qReasons" in some places but not others, introducing a fatal JavaScript error when submitting the page.
Replace ALL instances of "qComments" with "qReasons".
Working survey attached:
Replace ALL instances of "qComments" with "qReasons".
Working survey attached:
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Last edit: il y a 5 mois 3 semaines by tpartner.
Les utilisateur(s) suivant ont remercié: nique
Connexion ou Créer un compte pour participer à la conversation.
- nique
-
Auteur du sujet
- Hors Ligne
- Junior Lime
-
Réduire
Plus d'informations
- Messages : 28
- Remerciements reçus 0
il y a 6 mois 2 semaines #171942
par nique
COM_KUNENA_MESSAGE_REPLIED_NEW
Ugh just that one line at the very end! My eyes clearly glazed over it.
Thanks for picking that up for me! Error corrected and noted for future.
Thanks for picking that up for me! Error corrected and noted for future.
Connexion ou Créer un compte pour participer à la conversation.