- Posts: 10115
- Thank you received: 3597
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
Multiple question types in array modifiy
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
13 years 4 months ago #53546
by tpartner
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Replied by tpartner on topic Multiple question types in array modifiy
Oh, and some XHTML validators might whine about those elements being there but that's just because they're not smart enough to realize that the tags are just quoted inside a script.
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
- holch
- Away
- LimeSurvey Community Team
Less
More
- Posts: 11681
- Thank you received: 2748
13 years 4 months ago #53548
by holch
I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.
Replied by holch on topic Multiple question types in array modifiy
Hi TPartner!
Thanks for letting me know. I am little "out" of the whole XHTML and CSS stuff. I know that the trailing slash is closing the element, but I was not aware that DIVs could be used this way. I thought this would be limited to some elements like IMG, HR, etc.
Thanks for letting me know. I am little "out" of the whole XHTML and CSS stuff. I know that the trailing slash is closing the element, but I was not aware that DIVs could be used this way. I thought this would be limited to some elements like IMG, HR, etc.
I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.
The topic has been locked.
- phpsurvey
- Topic Author
- Offline
- Junior Member
Less
More
- Posts: 29
- Thank you received: 0
13 years 4 months ago #53601
by phpsurvey
Replied by phpsurvey on topic Multiple question types in array modifiy
My questions have a different size(height). I want to set the height variable like
or
But this doesn't works. How can I set the questions to a different height???
Code:
'height':'100%'
or
Code:
'min-height':'30px'
But this doesn't works. How can I set the questions to a different height???
Code:
// Adjust cell heights so everything lines up nicely horizontally $( 'td.answer, td.questiontext' ).css({ 'height':'35px', 'overflow':'hidden' });
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10115
- Thank you received: 3597
13 years 1 month ago #58772
by tpartner
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Replied by tpartner on topic Multiple question types in array modifiy
Option 5?
Can you provide a screenshot showing what you want?
Can you provide a screenshot showing what you want?
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
- phpsurvey
- Topic Author
- Offline
- Junior Member
Less
More
- Posts: 29
- Thank you received: 0
13 years 1 month ago - 13 years 1 month ago #58773
by phpsurvey
Replied by phpsurvey on topic Aw: Re:Multiple question types in array modifiy
this is what i wanted to post :
Hi,
I have a question to this solution. How can I reduce the distance between the first and the second block? Betwenn Option 5 and the short-text is a too big distance. Can you show me the part in tpartners source code to reduce this distance.
Thank you !!!
tpartner wrote: This should do the trick.
Create a short-text question and an array question with only one answer. Insert the following script in the source of one of them. Replace "11" (line 5) with the ID of the short-text and "22" (line 6) with the ID of the array you want inline.
Note that the styles inserted here only apply to the default template and you my need to adjust the padding in line 40 if any of your array labels wrap.
Code:<script type="text/javascript" charset="utf-8"> $(document).ready(function() { var qText = 11; var qArray = 22; // Fix the width of the survey $( 'table.outerframe' ).css({'width': '900px'}); // Wrap the 2 questions ina container div and style it $('#question'+qText+', #question'+qArray+'').wrapAll('<div class="inlineWrapper" />'); $('.inlineWrapper').append('<div style="clear:both" />'); $('.inlineWrapper').css({ 'width': '75%', 'margin':'0 auto 10px auto', 'background-color':'#FFFFFF' }); $('.inlineWrapper *').css({ 'padding': '0', 'margin':'0' }); // Hide the question and the help text $('#question'+qText+' td.questiontext, #question'+qArray+' td.questiontext').parent().hide(); $('#question'+qText+' > table:eq(1), #question'+qArray+' > table:eq(1)').hide(); $('#question'+qText+' td.survey-question-help, #question'+qArray+' td.survey-question-help').parent().hide(); //Hide the answer cell of the array $('#question'+qArray+' table.question thead tr').children(":first").hide(); $('#question'+qArray+' table.question tbody tr').children(":first").hide(); $('#question'+qArray+' col').attr('width', ''); // Push all question tables to 100% $('#question'+qText+' table, #question'+qArray+' table').css({'width': '100%'}); // Get the 2 questions to sit politely side by side $('#question'+qText+', #question'+qArray+'').css({'float':'left'}); $('#question'+qText+'').css({'padding':'15px 0 5px 25px'}); $('#question'+qText+'').css({'padding-top':'27px'}); // Adjust here for wrapped array labels $('#question'+qArray+'').css({'padding':'5px 0 10px 0'}); $('#question'+qArray+' table.question td').css({'padding':'4px'}); $('#question'+qText+' table:first').attr('align', 'left'); $('#question'+qText+' label').css({ 'display':'inline', 'width':'auto', 'margin-right':'10px' }); // Set the widths of the 2 questions $('#question'+qText+'').css({'width': '35%'}); $('#question'+qArray+'').css({'width': '58%'}); }); </script>
Hi,
I have a question to this solution. How can I reduce the distance between the first and the second block? Betwenn Option 5 and the short-text is a too big distance. Can you show me the part in tpartners source code to reduce this distance.
Thank you !!!
Last edit: 13 years 1 month ago by phpsurvey.
The topic has been locked.
- phpsurvey
- Topic Author
- Offline
- Junior Member
Less
More
- Posts: 29
- Thank you received: 0
13 years 1 month ago #58789
by phpsurvey
Replied by phpsurvey on topic Aw: Re:Multiple question types in array modifiy
the solution is very easy:
$('.inlineWrapper *').css({
'padding': '0',
'margin':'0',
'margin-top':'-5px'
});
with margin-top - 5px you get it
$('.inlineWrapper *').css({
'padding': '0',
'margin':'0',
'margin-top':'-5px'
});
with margin-top - 5px you get it
The topic has been locked.
- BodasDeSangre
- Offline
- New Member
Less
More
- Posts: 3
- Thank you received: 0
13 years 2 weeks ago #59641
by BodasDeSangre
Replied by BodasDeSangre on topic Multiple question types in array modifiy
Hello, I have been following all this post and it's very interesting... Here is the solution to my problem...
But I have a problem and I appreciate if you can help me.
I tried to do the example... but something is wrong. The questions are shown individually and the idea is that the questions are shown in an array.
In the image, we can see the result of the example.
But I have a problem and I appreciate if you can help me.
I tried to do the example... but something is wrong. The questions are shown individually and the idea is that the questions are shown in an array.
In the image, we can see the result of the example.
Attachments:
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10115
- Thank you received: 3597
13 years 2 weeks ago #59650
by tpartner
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Replied by tpartner on topic Multiple question types in array modifiy
BodasDeSangre, I've re-written the
"Multiple question types in array" workaround
to simplify the code and implementation. Try with the new code.
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
- BodasDeSangre
- Offline
- New Member
Less
More
- Posts: 3
- Thank you received: 0
13 years 2 weeks ago #59652
by BodasDeSangre
Replied by BodasDeSangre on topic Multiple question types in array modifiy
I'll try it and tell you the results,
Thank you very much for the reply.
PD: I apologize for my English, I'm learning.
Thank you very much for the reply.
PD: I apologize for my English, I'm learning.
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10115
- Thank you received: 3597
13 years 2 weeks ago #59666
by tpartner
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Replied by tpartner on topic Multiple question types in array modifiy
It's MUCH better than my Spanish!PD: I apologize for my English, I'm learning.
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
- BodasDeSangre
- Offline
- New Member
Less
More
- Posts: 3
- Thank you received: 0
13 years 2 weeks ago #59723
by BodasDeSangre
Replied by BodasDeSangre on topic Multiple question types in array modifiy
Thanks Tony!, it works!.
I have a last question (I hope), The code works with the default template, I tried to do it with a custom template but all the questions disappear. What things should i modified to adapt the code to my template?
Thank you very much.
I have a last question (I hope), The code works with the default template, I tried to do it with a custom template but all the questions disappear. What things should i modified to adapt the code to my template?
Thank you very much.
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10115
- Thank you received: 3597
13 years 2 weeks ago #59736
by tpartner
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Replied by tpartner on topic Multiple question types in array modifiy
I cannot say without seeing the template.What things should i modified to adapt the code to my template?
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.