Welcome to the LimeSurvey Community Forum

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

Calculations in array number with text input

  • rgiacolst
  • rgiacolst's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
8 years 6 months ago #125859 by rgiacolst
I need some help on how to proceed in the following question (image attached for better understanding).

I have a number array with text input represented by the image attached.

Necessary that the fields highlighted in yellow, have the input of data disabled.

These disabled fields will be automatically populated as follows (for easy reference by the lines will start by the letter and the speakers at start number):

A1 = B1 + C1
A2 = B2 + C2
A3 = A1 / A2
A4 = 100.0

B3 = B1 / B2
B4 = (B1 / A1) * 100

C1 = D1 + E1
C2 = D2 + E2
C3 = C1 / C2
C4 = (C1 / A1) * 100

D3 = D1 / D2
D4 = (D1 / C1) * 100

E3 = E1 / E2
E4 = (E1 / C1) * 100

I searched the forum and found some solutions in javascript, but I have no knowledge of javascript and also did not identify any similar question in the forum who could try to fit my needs.

If anyone can help solve, right now I'm grateful.
The topic has been locked.
  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
8 years 6 months ago #125863 by holch
Without Javascript this won't be possible, because you will need it to make it not writeable for the respondent and you might need to write the values into the boxes via Javascript as well.

However, I think what you could do is to create a question where respondents insert the required values and then later you create a text display question and create a table with the values inserted via Expression Manager. So while respondents insert the figures for the number of students and classes.

I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.

The following user(s) said Thank You: rgiacolst
The topic has been locked.
  • rgiacolst
  • rgiacolst's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
8 years 6 months ago #125869 by rgiacolst
Replied by rgiacolst on topic Calculations in array number with text input
Holch,

It had initially considered creating a question for interviewees launch and then display a text view of the question, but my biggest problem is in fact requesting the information already in the desired layout in order to facilitate understanding of the information requested by the interviewees. I've had other surveys I used the proposed manner and had a problem in the launch of informations among the interviewees.

Elsewhere in the same survey, could enjoy aggregation of the issues some javascript code present in the forum. My problem was this part specifies where I found no code that could help me.

My intention in posting this in the forum to get help of someone who knows javascript get a code that helps me results I need, as well as, get further understand this code in order to use in other surveys.

Seen in various posts with the aid of javascript is possible extender incredible way the limesurvey features.

Thank you for your tips and help.
The topic has been locked.
  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
8 years 6 months ago - 8 years 6 months ago #125876 by holch
Problem is that Tpartner, our Javascript specialist is on holidays since yesterday for 3 weeks... ;-)

And I have no idea how to do this in Javascript. Maybe someone else does.

I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.

Last edit: 8 years 6 months ago by holch.
The following user(s) said Thank You: rgiacolst
The topic has been locked.
  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
8 years 6 months ago #125880 by holch
What is going on here? Same question, different users?

Please talk to each other. No cross psots.
www.limesurvey.org/en/forum/can-i-do-thi...th-text-input#125879

I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.

The following user(s) said Thank You: rgiacolst
The topic has been locked.
  • rgiacolst
  • rgiacolst's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
8 years 5 months ago #125910 by rgiacolst
Replied by rgiacolst on topic Calculations in array number with text input
holch

I'll trying to find alternatives. I'm trying to enterder some javascript codes I found the forum and doing tests to see if I can adapt something.

This being an optimal opportunity for me to begin to learn some javascript.
The topic has been locked.
More
8 years 5 months ago #125986 by first
get ids of A1 B1 and C1 using developer tool inspect element and then something like this.
Let x , y and z are corresponding ids then
Code:
<script>
$(function(){
  $('input:text').on('keyup',function(){
    var A1val = Number($('#x').val());
    var B1val = Number($('#y').val());
    $('#z').val(A1val + B1val);
  });
});
</script>
Note: Code is not tested.

Survey Designer and Programmer
The following user(s) said Thank You: rgiacolst
The topic has been locked.
  • rgiacolst
  • rgiacolst's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
8 years 5 months ago #126024 by rgiacolst
Replied by rgiacolst on topic Calculations in array number with text input
OMdev

I will test. Thank you
The topic has been locked.
  • rgiacolst
  • rgiacolst's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
8 years 5 months ago #126060 by rgiacolst
Replied by rgiacolst on topic Calculations in array number with text input
OMdev

Tested Your tip and met my needs perfectly.

thank you
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose