- Posts: 28
- Thank you received: 2
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
[SOLVED] Is it possible to setup a Table(text) question as follow ?
- mapage
- Topic Author
- Offline
- Junior Member
Less
More
9 months 2 weeks ago - 9 months 2 weeks ago #245352
by mapage
Is it possible to setup a Table(text) question as follow ? was created by mapage
Please help us help you and fill where relevant:
Your LimeSurvey version: LimeSurvey Community Edition Version 6.1.8+230717
Own server or LimeSurvey hosting: own server (Synology)
Survey theme/template: Fruity
LSS :
==================
Bonjour,
I need to gather some information to be used within the survey :
a) a profile type (home, at work, outside) which result will help to filter some useless answers
b) how many people are considered (1 to ten) used outside the survey to calculate quantities
c) how many children are included there (0 to the number indicated in the b) sub-question.
I've seen an old post that I imported in the lss attached in the G1 but the script does not work anymore for forcing the numbers on the second column, moreover, I would need to use the answer made at section b) to validate the input at section c)... can you help ?
Thanks a lot in advance
Subsidiary question : I am quite lost with the search tool of the forum, googling return more result than the search but often older posts... is there somewhere a "help" that I could use to improve my searching ?
cri@mapage
Your LimeSurvey version: LimeSurvey Community Edition Version 6.1.8+230717
Own server or LimeSurvey hosting: own server (Synology)
Survey theme/template: Fruity
LSS :
==================
Bonjour,
I need to gather some information to be used within the survey :
a) a profile type (home, at work, outside) which result will help to filter some useless answers
b) how many people are considered (1 to ten) used outside the survey to calculate quantities
c) how many children are included there (0 to the number indicated in the b) sub-question.
I've seen an old post that I imported in the lss attached in the G1 but the script does not work anymore for forcing the numbers on the second column, moreover, I would need to use the answer made at section b) to validate the input at section c)... can you help ?
Thanks a lot in advance
Subsidiary question : I am quite lost with the search tool of the forum, googling return more result than the search but often older posts... is there somewhere a "help" that I could use to improve my searching ?
cri@mapage
Attachments:
Last edit: 9 months 2 weeks ago by mapage. Reason: ensure the lss is available + the page setup is readable
Please Log in to join the conversation.
- Joffm
- Away
- LimeSurvey Community Team
Less
More
- Posts: 13052
- Thank you received: 4018
9 months 2 weeks ago - 9 months 2 weeks ago #245365
by Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Replied by Joffm on topic Is it possible to setup a Table(text) question as follow ?
Hi,
this is a typical case of validation.
Like Q1_Y001_X002.NAOK le 10 AND Q1_Y001_X003.NAOK le Q1_Y001_X002.NAOK
for all rows.
Or if you insert a drop-down into AnswerB maybe like this
(is_empty(Q1_SQ001_AnswerC) OR is_numeric(Q1_SQ001_AnswerC)) and (Q1_SQ001_AnswerC.NAOK le Q1_SQ001_AnswerB.NAOK)
for all rows.
And the script?
It is to insert a drop-down into column coded "AnswerA".
So not really related to your question.
I do not see an issue here.
At the end there are the array(numbers).
You already asked about this and @tpartner provided a very flexible solution.
But even you are part of the problem.
With your topic "Is it possible to setup a Table(text) question as follow ?"
Who do you think will find this if he searchs for the validation / limitation of an entered number?
Joffm
this is a typical case of validation.
Like Q1_Y001_X002.NAOK le 10 AND Q1_Y001_X003.NAOK le Q1_Y001_X002.NAOK
for all rows.
Or if you insert a drop-down into AnswerB maybe like this
(is_empty(Q1_SQ001_AnswerC) OR is_numeric(Q1_SQ001_AnswerC)) and (Q1_SQ001_AnswerC.NAOK le Q1_SQ001_AnswerB.NAOK)
for all rows.
And the script?
It is to insert a drop-down into column coded "AnswerA".
So not really related to your question.
I do not see an issue here.
At the end there are the array(numbers).
You already asked about this and @tpartner provided a very flexible solution.
So am I.I am quite lost with the search tool of the forum
But even you are part of the problem.
With your topic "Is it possible to setup a Table(text) question as follow ?"
Who do you think will find this if he searchs for the validation / limitation of an entered number?
Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Last edit: 9 months 2 weeks ago by Joffm.
The following user(s) said Thank You: tammo
Please Log in to join the conversation.
- mapage
- Topic Author
- Offline
- Junior Member
Less
More
- Posts: 28
- Thank you received: 2
9 months 2 weeks ago #245406
by mapage
Replied by mapage on topic Is it possible to setup a Table(text) question as follow ?
@Joffm, thanks a lot for this reply.
What you did is exactly what I need . Where shall I insert this validation ? In the condition area or in the Regex one ?
Initially I thought this should be done through the script, as the description of the post was mentioning this, but you are right, I could not find any references to a check format on the script so.... I must be somewhere else..
Regarding the forum, you are fully right also but as the subject field has a nbchar limitation, I had to find something...
And thanks to you and all the comments and judgment on my questions, the way I write, what I ask... each post helps me to be a better newby .
Cheers
What you did is exactly what I need . Where shall I insert this validation ? In the condition area or in the Regex one ?
Initially I thought this should be done through the script, as the description of the post was mentioning this, but you are right, I could not find any references to a check format on the script so.... I must be somewhere else..
Regarding the forum, you are fully right also but as the subject field has a nbchar limitation, I had to find something...
And thanks to you and all the comments and judgment on my questions, the way I write, what I ask... each post helps me to be a better newby .
Cheers
Please Log in to join the conversation.
- Joffm
- Away
- LimeSurvey Community Team
Less
More
- Posts: 13052
- Thank you received: 4018
9 months 2 weeks ago #245408
by Joffm
Validations - except regex - are done in "Logic / question validation equation"
as you read in the manual in each "question type"
[url] manual.limesurvey.org/Question_type_-_Ar...28em_validation_q.29 [/url]
Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Replied by Joffm on topic Is it possible to setup a Table(text) question as follow ?
Neither nor.Where shall I insert this validation ? In the condition area or in the Regex one ?
Validations - except regex - are done in "Logic / question validation equation"
as you read in the manual in each "question type"
[url] manual.limesurvey.org/Question_type_-_Ar...28em_validation_q.29 [/url]
Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
The following user(s) said Thank You: mapage
Please Log in to join the conversation.
- mapage
- Topic Author
- Offline
- Junior Member
Less
More
- Posts: 28
- Thank you received: 2
9 months 2 weeks ago #245441
by mapage
Replied by mapage on topic Is it possible to setup a Table(text) question as follow ?
Tks again for the answers, I could find the right place under the Logic section.
Regarding the script, I still face an issue because the dropdown is available but do not store any results, even when I am choosing something else than the default.
Quite happy to get every day closer to the end of the project and a big bravo to the whole team for the amazing work and support you are doing. Merci.
Regarding the script, I still face an issue because the dropdown is available but do not store any results, even when I am choosing something else than the default.
Quite happy to get every day closer to the end of the project and a big bravo to the whole team for the amazing work and support you are doing. Merci.
Please Log in to join the conversation.
- Joffm
- Away
- LimeSurvey Community Team
Less
More
- Posts: 13052
- Thank you received: 4018
9 months 2 weeks ago #245442
by Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Replied by Joffm on topic Is it possible to setup a Table(text) question as follow ?
Hi,
how shall we solve your problems without seeing your survey?
Please, provide the lss export.
how shall we solve your problems without seeing your survey?
Please, provide the lss export.
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Please Log in to join the conversation.
- mapage
- Topic Author
- Offline
- Junior Member
Less
More
- Posts: 28
- Thank you received: 2
9 months 2 weeks ago #245444
by mapage
Replied by mapage on topic Is it possible to setup a Table(text) question as follow ?
I'll stop keeping you busy : validation step is 90% covering the need + setting the question not mandatory it works around the issue I had.
For this the validation at the right place as explained previously is very good.
Note that validation only "tips" is very good if you do not need multilingual help as it's a global solution for the question.
PS: lss was the one you've used to say I did wrong (again ).
For this the validation at the right place as explained previously is very good.
Note that validation only "tips" is very good if you do not need multilingual help as it's a global solution for the question.
PS: lss was the one you've used to say I did wrong (again ).
Please Log in to join the conversation.
- Joffm
- Away
- LimeSurvey Community Team
Less
More
- Posts: 13052
- Thank you received: 4018
9 months 2 weeks ago #245445
by Joffm
I do not see an issue
The only things are:
1. There is no code for "Home"
2. You store the text insted of the codes. This is because you use a script to store the text.
To store the code you should exchange the "Listener" and "Returning to page" part by
Switch the language and enter the tip.
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Replied by Joffm on topic Is it possible to setup a Table(text) question as follow ?
What do you mean by this?because the dropdown is available but do not store any result
I do not see an issue
The only things are:
1. There is no code for "Home"
2. You store the text insted of the codes. This is because you use a script to store the text.
To store the code you should exchange the "Listener" and "Returning to page" part by
Code:
// Listeners $('.inserted-select', thisQuestion).on('change', function(i) { if($(this).val() != '') { $(this).closest('.answer-item').find('input:text').val($('option:selected', this).val()).trigger('change'); } else { $(this).closest('.answer-item').find('input:text').val('').trigger('change'); } });// Returning to page $('.with-select input:text', thisQuestion).each(function(i) { var thisCell = $(this).closest('.answer-item'); var inputText = $.trim($(this).val()); $('select.inserted-select', thisCell).val(inputText); });
Of course not.only "tips" is very good if you do not need multilingual help as it's a global solution for the question.
Switch the language and enter the tip.
Volunteers are not paid.
Not because they are worthless, but because they are priceless
The following user(s) said Thank You: mapage
Please Log in to join the conversation.
- mapage
- Topic Author
- Offline
- Junior Member
Less
More
- Posts: 28
- Thank you received: 2
9 months 2 weeks ago - 6 months 3 days ago #245471
by mapage
Replied by mapage on topic [SOLVED] Is it possible to setup a Table(text) question as follow ?
Great for the translation.. even if between js in the code of the question, tips in the validation code, it can be a certain burden to maintain..
Regarding the js, the issue might have been linked to the <option value=""> which was "" instead of "0", but in the end, I've removed the mandatory and only setup the validation test you gave me.
All fine at the moment from my side now
Again thank you for your help.
Regarding the js, the issue might have been linked to the <option value=""> which was "" instead of "0", but in the end, I've removed the mandatory and only setup the validation test you gave me.
All fine at the moment from my side now
Again thank you for your help.
Code:
<script type="text/javascript" charset="utf-8"> $(document).on('ready pjax:scriptcomplete',function(){ var thisQuestion = $('#question{QID}'); // Insert selects $('.answer-item.answer_cell_TP01a', thisQuestion).addClass('with-select').append('<select class="inserted-select form-control list-question-select">\ <option value="">Type 1</option>\ <option value="1">Type 2</option>\ <option value="2">Type 3</option>\ </select>'); // Listeners $('.inserted-select', thisQuestion).on('change', function(i) { if($(this).val() != '') { $(this).closest('.answer-item').find('input:text').val($.trim($('option:selected', this).text())).trigger('change'); } else { $(this).closest('.answer-item').find('input:text').val('').trigger('change'); } }); // Returning to page $('.with-select input:text', thisQuestion).each(function(i) { var thisCell = $(this).closest('.answer-item'); var inputText = $.trim($(this).val()); var selectval = $('select.inserted-select option', thisCell).filter(function () { return $(this).html() == inputText; }).val(); $('select.inserted-select', thisCell).val(selectval); }); // Clean-up styles $('select.inserted-select', thisQuestion).css({ 'max-width': '100%' }); $('.with-select input:text', thisQuestion).css({ 'position': 'absolute', 'left': '-9999em' }); }); </script>
Last edit: 6 months 3 days ago by mapage.
Please Log in to join the conversation.