- Posts: 5
- Thank you received: 0
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
Changing column width of array text
- Limer2001
- Topic Author
- Offline
- New Member
Less
More
11 years 15 minutes ago #95326
by Limer2001
Changing column width of array text was created by Limer2001
Hi,
how can I change the column width for questions of the type: array text?
I want the question textcolumn to be 5% first column 70% second answer column 25%.
Tried different things with css and javascript but can't get it to work..
I'm on 2.00+ Build 130423
how can I change the column width for questions of the type: array text?
I want the question textcolumn to be 5% first column 70% second answer column 25%.
Tried different things with css and javascript but can't get it to work..
I'm on 2.00+ Build 130423
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10109
- Thank you received: 3593
10 years 11 months ago #95335
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 Changing column width of array text
Try something like this in the source of the question:
Code:
<script type="text/javascript" charset="utf-8"> $(document).ready(function() { var qID = {QID}; $('#question'+qID+' .subquestions-list col').css({ 'width':'auto' }); $('#question'+qID+' .subquestions-list thead td').css({ 'width':'5%' }); $('#question'+qID+' .subquestions-list thead th:eq(0)').css({ 'width':'70%' }); $('#question'+qID+' .subquestions-list thead th:eq(2)').css({ 'width':'25%' }); $('#question'+qID+' .subquestions-list input[type="text"]').css({ 'width':'90%' }); }); </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.
- Limer2001
- Topic Author
- Offline
- New Member
Less
More
- Posts: 5
- Thank you received: 0
10 years 11 months ago #95338
by Limer2001
Replied by Limer2001 on topic Changing column width of array text
Thank you it's working with the standard template I just need to make it work with my own...
Attachments:
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10109
- Thank you received: 3593
10 years 11 months ago #95340
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 Changing column width of array text
That's because you have a JavaScript error - imagetick_lime.js is called before jQuery.
In startpage.pstpl, change this:
To this:
In startpage.pstpl, change this:
Code:
<script type="text/javascript" src="{TEMPLATEURL}imagetick_lime.js"></script> {TEMPLATEJS}
To this:
Code:
{TEMPLATEJS} <script type="text/javascript" src="{TEMPLATEURL}imagetick_lime.js"></script>
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: Limer2001
The topic has been locked.
- Limer2001
- Topic Author
- Offline
- New Member
Less
More
- Posts: 5
- Thank you received: 0
10 years 11 months ago #95342
by Limer2001
Replied by Limer2001 on topic Changing column width of array text
The topic has been locked.
- achecchini
- Offline
- Senior Member
Less
More
- Posts: 61
- Thank you received: 0
6 years 5 months ago #160050
by achecchini
Replied by achecchini on topic Changing column width of array text
This is an old thread but very useful for me. I want to change the width of the question column in a text array. So I try to use the example above changing the script in the question like this:
<script type="text/javascript" charset="utf-8">
$(document).ready(function() {
var qID = {QID};
$('#question'+qID+' .subquestions-list col').css({ 'width':'auto'} );
$('#question'+qID+' .subquestions-list thead td').css({ 'width':'40%' });
$('#question'+qID+' .subquestions-list thead th:eq(0)').css({ 'width':'15%' });
$('#question'+qID+' .subquestions-list thead th:eq(1)').css({ 'width':'15%' });
$('#question'+qID+' .subquestions-list thead th:eq(2)').css({ 'width':'15%' });
$('#question'+qID+' .subquestions-list thead th:eq(3)').css({ 'width':'15%' });
$('#question'+qID+' .subquestions-list input[type="text"]').css({ 'width':'90%' });
});
</script>
If I test the script on the single question this perfectly function; but when I start whole survey I catch an error: undefinite offeset: -1 It's a template error?
Cause my lack of knowledge in programming I didn't find a solution !! Note that if I drop the code from the question I didn't catch any error ...
Thanks in advance for helping me!
A.
<script type="text/javascript" charset="utf-8">
$(document).ready(function() {
var qID = {QID};
$('#question'+qID+' .subquestions-list col').css({ 'width':'auto'} );
$('#question'+qID+' .subquestions-list thead td').css({ 'width':'40%' });
$('#question'+qID+' .subquestions-list thead th:eq(0)').css({ 'width':'15%' });
$('#question'+qID+' .subquestions-list thead th:eq(1)').css({ 'width':'15%' });
$('#question'+qID+' .subquestions-list thead th:eq(2)').css({ 'width':'15%' });
$('#question'+qID+' .subquestions-list thead th:eq(3)').css({ 'width':'15%' });
$('#question'+qID+' .subquestions-list input[type="text"]').css({ 'width':'90%' });
});
</script>
If I test the script on the single question this perfectly function; but when I start whole survey I catch an error: undefinite offeset: -1 It's a template error?
Cause my lack of knowledge in programming I didn't find a solution !! Note that if I drop the code from the question I didn't catch any error ...
Thanks in advance for helping me!
A.
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10109
- Thank you received: 3593
6 years 5 months ago #160052
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 Changing column width of array text
Please attach an exported .lss file of a small test survey.
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
- achecchini
- Offline
- Senior Member
Less
More
- Posts: 61
- Thank you received: 0
6 years 5 months ago #160053
by achecchini
Replied by achecchini on topic Changing column width of array text
Tanks for quick response. But now I was a little confused
because the survey it's a very very long survey (7 groups for 86 question!!) I try to export only the group where I use the code in a new survey. BUT when I test the single question and the new survey (with only a group) I didn't catch errors and it's now functioning !!
Please give me more time for analyzing this and replicate the error !!
A.
because the survey it's a very very long survey (7 groups for 86 question!!) I try to export only the group where I use the code in a new survey. BUT when I test the single question and the new survey (with only a group) I didn't catch errors and it's now functioning !!
Please give me more time for analyzing this and replicate the error !!
A.
The topic has been locked.
- achecchini
- Offline
- Senior Member
Less
More
- Posts: 61
- Thank you received: 0
6 years 5 months ago #160056
by achecchini
Replied by achecchini on topic Changing column width of array text
I have solved the problem by cancelling all the actual answer recorded in the DB!! VERY strange!
Because the survey it's in a testing phase no matter. I'm asking to me if this behavior may be a symptom of inconsistence for the platform or the DB ...
Thank in any case for your attention!
Have a nice day
A.
Because the survey it's in a testing phase no matter. I'm asking to me if this behavior may be a symptom of inconsistence for the platform or the DB ...
Thank in any case for your attention!
Have a nice day
A.
The topic has been locked.
- orsegal
- Offline
- New Member
Less
More
- Posts: 1
- Thank you received: 0
4 years 8 months ago #187802
by orsegal
Replied by orsegal on topic Changing column width of array text
Hi,
Thanks for the great help here!
I know it's an old thread, so hoping I'm not asking something that's already been answered somewhere else.
I'm trying to get this fix to work in my survey (version 3.17.7) and it's not playing along. Any ideas?
The exported sample survey is attached and here's the code:
Thanks!
O
Thanks for the great help here!
I know it's an old thread, so hoping I'm not asking something that's already been answered somewhere else.
I'm trying to get this fix to work in my survey (version 3.17.7) and it's not playing along. Any ideas?
The exported sample survey is attached and here's the code:
Code:
<script type="text/javascript" charset="utf-8"> $(document).ready(function() { var qID = 4691; $('#question'+qID+' .subquestions-list col').css({ 'width':'auto' }); $('#question'+qID+' .subquestions-list thead td').css({ 'width':'10%' }); $('#question'+qID+' .subquestions-list thead th:eq(0)').css({ 'width':'30%' }); $('#question'+qID+' .subquestions-list thead th:eq(1)').css({ 'width':'10%' }); $('#question'+qID+' .subquestions-list thead th:eq(2)').css({ 'width':'10%' }); $('#question'+qID+' .subquestions-list thead th:eq(3)').css({ 'width':'10%' }); $('#question'+qID+' .subquestions-list thead th:eq(4)').css({ 'width':'30%' }); $('#question'+qID+' .subquestions-list input[type="text"]').css({ 'width':'90%' }); }); </script>
Thanks!
O
Attachments:
The topic has been locked.