Welcome to the LimeSurvey Community Forum

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

Adding different requirements for each row (Array (Texts))

  • xiaomeng0603
  • xiaomeng0603's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
2 years 11 months ago - 2 years 11 months ago #221344 by xiaomeng0603
Dear All

There are different requirements for each row (Array (Texts), 1.jpg).   
 

For the first row, the requirements are adding"%" and rang from 0% to 100% for each cell.
For the second row, the requirements are adding"€"  and the Minimum answer is 200€ for each cell.
The preferred table like the following picture 2.jpg
 

The file is attached  

File Attachment:

File Name: limesurvey...0_27.lss
File Size:18 KB


Thank you 
Last edit: 2 years 11 months ago by xiaomeng0603.
The topic has been locked.
  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
2 years 11 months ago #221362 by Joffm
Hi,
when you provide your lss, you ought to have included the previous schript to add the "%".

Okay;
here what I found by playing around and trying something
Code:
<script type="text/javascript" data-author="Tony Partner">    
    $(document).on('ready pjax:scriptcomplete',function(){
        // Input suffix
        $('#question{QID} tr:eq(1) .answer-item :text.form-control').after('<span class="inserted-suffix"> %</span>').css({
            'display': 'inline-block',
            'width': '80%'
        });
        $('#question{QID} tr:eq(2) .answer-item :text.form-control').after('<span class="inserted-suffix"> €</span>').css({
            'display': 'inline-block',
            'width': '80%'
        });
    });
</script>

 

But, in my opinion you waste too much time with theses "silly" things.
Anybody is used to this
 


And your other question is plain validation:
Validation equation "What is allowed?"
C1_Y001_X001 le 100 AND C1_Y001_X002 le 100 AND ...
C1_Y002_X001 le 200 AND C1_Y002_X002 le 200 AND ...

Ant the validation tip "What happens if there is a wrong answer?"
{if(C1_Y001_X001 gt 100 OR C1_Y001_X002 gt 100 OR ...,"Please, enter correct values,"")}
​​​​​​​
 




You see, that I coded the y-axis with Y001, Y002,... and the x-axis with X001, X002,...
And if you enter numbers you'd better use an array(numbers). So you have not to check that there is no text entered.

​​​​​​​Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless
The following user(s) said Thank You: xiaomeng0603
The topic has been locked.
  • xiaomeng0603
  • xiaomeng0603's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
2 years 11 months ago #221381 by xiaomeng0603
Thank you. It works. your suggestion is good for me, I will change my table.
The topic has been locked.
Moderators: tpartnerholch

Lime-years ahead

Online-surveys for every purse and purpose