Welcome to the LimeSurvey Community Forum

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

popuale fields in other group

  • djarnold01
  • djarnold01's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
8 years 8 months ago #142049 by djarnold01
popuale fields in other group was created by djarnold01
Hello again and thaks for your time

I'm trying to use autocomplete using this code
Code:
<script type="text/javascript" charset="utf-8">
 
        $(document).ready(function() {
 
                var qNameID = {p3.qid};
 
                var qIDID = {p44.qid};
var qSID = {p55.qid};
 
 
 
                var url = "{TEMPLATEURL}/views/unidades.csv";
 
 
                var namesArr = new Array();
 
 
                $.get(url,function(data){
 
 
                        fullArray = $.csv.toArrays(data);
 
 
                        $(fullArray).each(function(i, item){
                                namesArr.push(item[0]);
                        });
 
 
                        $('#question'+qNameID+' input.text').autocomplete({
                                source: namesArr,
 
                                select: function(event, ui) {
 
                                        $(fullArray).each(function(i, item){
                                                if(item[0] == ui.item.value) {
 
                                                        $('#question'+qIDID+' input.text').val(item[1]);
 
       $('#question'+qSID+' input.text').val(item[2]);                                                
                                                }
                                        });
                                }
                        });
                });
        });
 
</script>

this code autocomplete the p3 question and the value of p3 is searched in the csv file and inserts the value of column 2 and 3 in p44 and p55 questions

this code works only if p44 and p55 are next to p3 in the same group

is there any way to do the same but p44 and p55 questions will be in other group?
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
8 years 8 months ago - 8 years 8 months ago #142051 by tpartner
Replied by tpartner on topic popuale fields in other group
JavaScript can only work with elements on the same page.

You could use that script to populate two hidden short-text questions in the same group as p3 and then pipe those values into p44 and p55 in subsequent groups - perhaps with the Default Value setting.

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Last edit: 8 years 8 months ago by tpartner.
The topic has been locked.
  • djarnold01
  • djarnold01's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
8 years 8 months ago #142052 by djarnold01
Replied by djarnold01 on topic popuale fields in other group
I tried but no results

I used in p44 and p55 as default answerd {phidden.shown} {phidden1.shown}
The topic has been locked.
  • djarnold01
  • djarnold01's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
8 years 8 months ago #142053 by djarnold01
Replied by djarnold01 on topic popuale fields in other group
Also i tried to hidden 1 question and put the other question visible

Only the value of the visible question is inserted in the question of next group
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
8 years 8 months ago #142055 by tpartner
Replied by tpartner on topic popuale fields in other group
You need to hide the questions with JavaScript or CSS, not with the advanced question setting.

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
  • djarnold01
  • djarnold01's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
8 years 8 months ago - 8 years 8 months ago #142058 by djarnold01
Replied by djarnold01 on topic popuale fields in other group
Thaks! works great now
I used CSS like this
Code:
#answer996746X127X1316 {
   display: none;
}

but only hide the text field
the question number or question title is stil showing



EDIT:

change #answer with #question works now
Last edit: 8 years 8 months ago by djarnold01.
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
8 years 8 months ago #142099 by tpartner
Replied by tpartner on topic popuale fields in other group
Yes, but for the benefit of other readers, you leave out the group and question IDs.

So, something like this (where 996746 is the question ID):

Code:
#question996746 {
   display: none;
}

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The following user(s) said Thank You: djarnold01
The topic has been locked.
More
8 years 8 months ago #142110 by Ben_V
Replied by Ben_V on topic popuale fields in other group
or use javascript in the help area ...with dynamic {QID} placeholder
Code:
<script type="text/javascript">
    $('#question{QID}').hide();
</script>

Benoît

EM Variables => bit.ly/1TKQyNu | EM Roadmap => bit.ly/1UTrOB4
Last Releases => 2.6x.x goo.gl/ztWfIV | 2.06/2.6.x => bit.ly/1Qv44A1
Demo Surveys => goo.gl/HuR6Xe (already included in /docs/demosurveys)
The following user(s) said Thank You: tpartner
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
8 years 8 months ago #142143 by tpartner
Replied by tpartner on topic popuale fields in other group

or use javascript in the help area ...with dynamic {QID} placeholder

Yep, yep! ;)

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
Moderators: tpartnerholch

Lime-years ahead

Online-surveys for every purse and purpose