Welcome to the LimeSurvey Community Forum

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

Search Results (Searched for: html)

  • r0bis
  • r0bis's Avatar
20 Nov 2023 17:59 - 20 Nov 2023 21:43
remotecontrol error was created by r0bis
Please help us help you and fill where relevant:
Your LimeSurvey version: LimeSurvey Community Edition Version 6.3.6+231120 (PHP 7.4)
Own server or LimeSurvey hosting: own server, hosted on A2 provider, installed first via softaculous, maintained by paid comfortUpdate
Survey theme/template: default (Fruity) 
==================
After the last update today remotecontrol no longer works.

PHP has been 7.4 for a while on my server.
I use R for reports and data analysis. Until today limer worked well, after the update I get error on authentication:

> skey <- get_session_key()
Error: Argument 'txt' must be a JSON string, URL or file.

The options are correct, the same code worked yesterday. I had this type of error once before - first was
resolved by updating github cloudyr/limer to the latest version. Second time that was when hosting providers systems thought my ip was suspicious and was asking to solve captcha for login. After successful login to admin pages I was able to do remotecontrol again. 
This time I get the error and no idea how to troubleshoot. Remotecontrol is very important to us, an idea how to work on this would be much appreciated.

I played around with function from migliorati and came to conclusion some things work. But it seems that the response coming back from limesurvey might not be JSON or is an empty response altogether for example you do the usual limer options setup and then:

  body.json = list(method = "get_session_key",
                   id = 1,
                   params = list(username = getOption('lime_username'),
                                 password = getOption('lime_password')))
now you have the json rpc request (I think); then you give that request to httr:OST

POST(getOption('lime_api'),
            content_type_json(),
            body = jsonlite::toJSON(body.json,
                                    auto_unbox = TRUE))
you get a response similar to :Response [ lime.server.yours/index.php/admin/remotecontrol ]
Date: 2023-11-20 19:21
Status: 500
Content-Type: text/html; charset=UTF-8
Size: 20.8 kB
<!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.0 Transitional//EN"
" www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
<html xmlns=" www.w3.org/1999/xhtml " xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>ArgumentCountError</title>

<style type="text/css">
/*<![CDATA[*/

say instead of printing you save it to an object RRR, then we can see that it does not seem to be a JSON response at all through 
jsonlite::validate(RRR)Error in jsonlite::validate(content(RR, encoding = "utf-8")) :
is.character(txt) is not TRUE
  • r0bis
  • r0bis's Avatar
20 Nov 2023 17:44 - 20 Nov 2023 20:45
This is really quite bad, I get the same error and the only change I made was used comfort update. Now LS version is

LimeSurvey Community Edition Version 6.3.6+231120

and my PHP has been 7.4 for a good few months and until this update was working well.

I played around with function from migliorati and came to conclusion that a lot of things work. But it seems that the response coming back from limesurvey might not be JSON? for example you do the usual limer options setup and then:

  body.json = list(method = "get_session_key",
                   id = 1,
                   params = list(username = getOption('lime_username'),
                                 password = getOption('lime_password')))
now you have the json rpc request (I think); then you give that request to httr::POST

POST(getOption('lime_api'),
            content_type_json(),
            body = jsonlite::toJSON(body.json,
                                    auto_unbox = TRUE))
you get a response similar to :Response [ lime.server.yours/index.php/admin/remotecontrol ]
Date: 2023-11-20 19:21
Status: 500
Content-Type: text/html; charset=UTF-8
Size: 20.8 kB
<!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.0 Transitional//EN"
" www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
<html xmlns=" www.w3.org/1999/xhtml " xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>ArgumentCountError</title>

<style type="text/css">
/*<![CDATA[*/say instead of printing you save it to an object RRR, then I am sure in RRR$cookies[7] you have your session key

 
  • tpartner
  • tpartner's Avatar
18 Nov 2023 15:38
Replied by tpartner on topic Reset survey (delete answers) if quota are met
Have the quota redirect to a PHP page that uses the API to remove the response.

- api.limesurvey.org/classes/remotecontrol...thod_delete_response
  • tpartner
  • tpartner's Avatar
18 Nov 2023 15:29
A few problems,

- You don't need to load jQuery in your scripts - it is already loaded.
- There are some undefined variables in the script in the first question.
- The script in the second question is has several errors.

This script, placed in the source of an array-texts question will hide the text inputs and insert radio inputs to control them.

Code:
<script type="text/javascript" data-author="Tony Partner">
 
  $(document).on('ready pjax:scriptcomplete',function(){
    var thisQuestion = $('#question{QID}');
 
    // If inserted radios not present
    if ($('.inserted-radio', thisQuestion).length == 0) {
 
      // Define the radio list HTML
      var radioTemplate = '<ul class="list-unstyled radio-list">\
        <li class="answer-item radio-item">\
          <input type="radio" class="inserted-radio" value="1" name="SGQA" id="inserted-radio-SGQA-1">\
          <label for="inserted-radio-SGQA-1" class="control-label radio-label">Yes</label>\
        </li>\
        <li class="answer-item radio-item">\
          <input type="radio" class="inserted-radio" value="2" name="SGQA" id="inserted-radio-SGQA-2">\
          <label for="inserted-radio-SGQA-2" class="control-label radio-label">No</label>\
        </li>\
        <li class="answer-item radio-item">\
          <input type="radio" class="inserted-radio" value="3" name="SGQA" id="inserted-radio-SGQA-3">\
          <label for="inserted-radio-SGQA-3" class="control-label radio-label">??</label>\
        </li>\
      </ul>';
 
      // Insert the radios
      $('.answer-item', thisQuestion).addClass('with-radios').each(function() {
        var thisSQID = $(':text.form-control', this).attr('id').replace(/answer/, '');        
        var radioHtml = radioTemplate.replace(/SGQA/g, thisSQID);
        $(this).append(radioHtml);
      });
    }
 
    // Listener on the radios
    $('.radio-item :radio', thisQuestion).on('click', function() {
      $(this).closest('td').find(':text.form-control').val($(this).val()).trigger('keyup');
    });
 
    // Returning to the page
    $(':text.form-control', thisQuestion).filter(function() {
      return $.trim($(this).val()) != '';
    }).each(function() {
      var thisCell = $(this).closest('td');
      var thisVal = $.trim($(this).val());
      $('.inserted-radio[value="'+thisVal+'"]', thisCell).trigger('click');
    });
 
    // Apply some styles
    $(':text.form-control', thisQuestion).css({
      'position': 'absolute',
      'left': '-9999em'
    });
    $('.radio-list', thisQuestion).css({
      'text-align': 'left'
    });
  });
</script>
  • bhavik
  • bhavik's Avatar
17 Nov 2023 22:52
Here is the script:

<script type="text/javascript" src=" code.jquery.com/jquery-3.6.0.min.js ">
<script type="text/javascript">
    $(document).ready(function() {
        var checkClosest = function(event) {
            event.target.firstElementChild.click();
        };

        var thisQuestion = $('#question{QID}');

        // Insert dropdowns
        if (!thisQuestion.find(".inserted-dropdown").length) {
            var dropdownTemplate = '<div style="text-align: left" class="list-question-select">\
                <span class="clickable-span">\
                    <select class="inserted-dropdown" name="dropdown_{QID}">\
                        <option value="">Please choose</option>\
                        <option value="rare, not severe">rare, not severe</option>\
                        <option value="rare, severe">rare, severe</option>\
                        <option value="occasional, not severe">occasional, not severe</option>\
                        <option value="occasional, severe">occasional, severe</option>\
                        <option value="frequent, not severe">frequent, not severe</option>\
                        <option value="frequent, severe">frequent, severe</option>\
                        <option value="No">Not Applicable</option>\
                    </select>\
                </span>\
            </div>';
            
            $('.answer-item', thisQuestion).addClass('with-select').each(function() {
                var dropdownHtml = dropdownTemplate.replace(/{QID}/g, $(this).data('qid'));
                $(this).append(dropdownHtml);
            });
        }
        
        // Insert date fields with "Know" and "Don't know" options
        if (!thisQuestion.find(".date-fields").length) {
            var dateFieldsTemplate = '<div class="date-fields" style="display: none;">\
                <div class="date-field-container">\
                    <label>Approx date of onset (if known):</label><br>\
                    <label class="know-label">Know:</label>\
                    <input type="date" class="date-field large-date" id="onset-date_{QID}">\
                    <br>\
                    <label class="dont-know-label">Don\'t know:</label>\
                    <input type="checkbox" class="dont-know-checkbox" id="dont-know-onset-date_{QID}">\
                </div>\
                <div class="date-field-container">\
                    <label>Approx end date (if at all):</label><br>\
                    <label class="know-label">Know:</label>\
                    <input type="date" class="date-field large-date" id="end-date_{QID}">\
                    <br>\
                    <label class="dont-know-label">Don\'t know:</label>\
                    <input type="checkbox" class="dont-know-checkbox" id="dont-know-end-date_{QID}">\
                </div>\
                <div class="inline-fields">\
                    <textarea class="comment-box" rows="3" cols="40" style="width: 100%;" placeholder="Comments"></textarea>\
                </div>\
            </div>';
            
            $('.answer-item', thisQuestion).each(function() {
                var dateFieldsHtml = dateFieldsTemplate.replace(/{QID}/g, $(this).data('qid'));
                $(this).append(dateFieldsHtml);
            });
        }

        thisQuestion.find("select[name^='dropdown']").each(function() {
            var currName = $(this).attr('name').substr(8);
            var listQuestionSelect = $(this).closest(".answer-item").find(".list-question-select");
            var dateFields = $(this).closest(".answer-item").find(".date-fields");
            
            listQuestionSelect.find('select').each(function() {
                $(this).attr('name', 'dropdown' + currName);
            });
            
            listQuestionSelect.find('select.inserted-dropdown').on("change", function(event) {
                var answerItem = $(this).closest('.answer-item');
                var selectedValue = $(this).val();
                var dateFields = answerItem.find('.date-fields');
                
                if (selectedValue !== '' && selectedValue !== 'No') {
                    dateFields.show();
                } else {
                    dateFields.hide();
                }
            });

            listQuestionSelect.find('.comment-box').on('click', function(event) {
                event.stopPropagation();
                
            });
        });
        


        // Clean-up styles
        $('select.inserted-dropdown').addClass('big-dropdown');
        $('.list-question-select span').addClass('clickable-span');
        $('.with-select input:text', thisQuestion).css({
            'position': 'absolute',
            'left': '-9999em'
        });
        
        // Hide all rows in the array text question initially
        $('[id^="javatbd128651X28X6425SQ"]').hide();
        //$('.ls-heading.ls-header .answertext.control-label[role="columnheader"]').hide(); // Hides the headers
        //$('.ls-heading.ls-heading-repeat').hide();
        $('#question6425').hide();
        
        $('[id^="answer128651X28X6347SQ"]').change(function() {
            // Extract the subquestion code from the checkbox ID
            var row = this.id.match(/SQ\d+$/)[0];
            console.log('row:', row);
        });
        
        var checkedQuestionCodes = []; // Initialize an empty array to store checked question codes
        // Event handler for radio button changes
        $('input.inserted-radio[type=radio]').change(function() {
            // Extract the last part of the name attribute which is the subQuestionCode
            var subQuestionCode = $(this).attr('name').split('_').pop();
            console.log('SubQuestionCode:', subQuestionCode);
            
            var name = $(this).attr('name');
            var sqIndex = name.indexOf('SQ'); // Find the index of 'SQ' in the string
            var questionCode = sqIndex !== -1 ? name.substring(sqIndex, sqIndex + 5) : null; // Extract 'SQ' and the following three characters
            
            // Check if the selected radio button's value is "1"
            if ($(this).val() === "1") {
                if (checkedQuestionCodes.indexOf(questionCode) === -1) {
                    checkedQuestionCodes.push('#javatbd128651X28X6425' + questionCode);
                }
                $('#javatbd128651X28X6425' + questionCode).show();
                $('.ls-heading.ls-header .answertext.control-label[role="columnheader"]').show();
                $('#question6425').show();
            } else {
                var index = checkedQuestionCodes.indexOf('#javatbd128651X28X6425' + questionCode);
                if (index !== -1) {
                    checkedQuestionCodes.splice(index, 1);
                }
                $('#javatbd128651X28X6425' + questionCode).hide();
            }
            console.log('Checked Question Codes:', checkedQuestionCodes);
        });
        $('input.inserted-radio[type=radio][value="1"]:checked').each(function() {
            $(this).trigger('change');
        });
        

        
    });
</script>
<style>
    .know-label,
    .dont-know-label {
        text-indent: 10px;
    }
    .ls-heading.ls-header .answertext.control-label[role="columnheader"] {
        background-color: #add8e6; /* Light blue color */
    }
</style>
 
  • Joffm
  • Joffm's Avatar
16 Nov 2023 13:02 - 16 Nov 2023 13:08
Replied by Joffm on topic Bedingte Fragen anhand von Schwellenwerten
Hallo,
Ich habe es doch geschrieben.

Hier die css-Klassen; diese kannst Du in der "custom.css" des erweiterten themes anfügen.

Hier werden ja neue Klassen definiert.
Gut, das steht jetzt zwar in der "custom.css", aber nirgendwo im ganzen LS Code werden sie benutzt.
Also musst Du eben sagen, bei welchen Fragen sie angesprochen werden.

Dazu werden die Namen im Feld css-Klassen eingetragen; aber das hast Du ja in der Beispielstudie gesehen

Wenn Du glaubst eine Klasse (oder Einstellung) nur sehr, sehr selten zu benutzen, kannst Du den Code auch im Fragetext (Quellcode-Modus) einfügen - also der Standard für kleine Sachen.
Nicht vergessen: Hier mit den <style></style> tags umschließen
Aber auch hier muss die Klasse ins Feld "css-Klassen"

Noch eine Erklärung:
Nur .question-title-container { display:none; } würde den Container mit dem Fragetext immer - bei jeder Frage - verstecken
.no-question .question-title-container { display:none; } versteckt ihn nur dann, wenn er nach der Klasse ".no-question" folgt.
Das ist die ganze Idee.

Und Tutorial:
Na, über css gibt es bestimmt hundert Videos auf Youtube.
Außerdem sind gute Quellen
[url] wiki.selfhtml.org/wiki/CSS [/url]
und
[url] www.w3schools.com/css/ [/url]

Joffm


 
  • Joffm
  • Joffm's Avatar
15 Nov 2023 13:04 - 15 Nov 2023 13:59
Could look like this
 
And as you display four subquestions you have to create an array with four subquestions and 6 answer options (some are not used)
A simple HTML table with the images.and the shown script with the following changes.
In the script the radio buttons are in the same cells as the image.
In this example there is a separate row below each image.

And please clarify

where you can only choose 1 option from all the options.

One choice of all 14?
Or one choice in each row?

Joffm
  • DenisChenu
  • DenisChenu's Avatar
15 Nov 2023 10:39 - 15 Nov 2023 10:42
Replied by DenisChenu on topic Really strange HTTP 500 when installing

Which HTML?
The html produced

And you have something like that : (to be unziped : HTML file)

And you can send it here to have a look at the issue …
  • urbana
  • urbana's Avatar
15 Nov 2023 10:36
Replied by urbana on topic Really strange HTTP 500 when installing
I am not 100% sure I follow you sorry :)

You recommend:
Doing this once:
debug = 2 and asset_manger false

Than saving the HTML
Which HTML?
  • DenisChenu
  • DenisChenu's Avatar
15 Nov 2023 10:33
Replied by DenisChenu on topic Really strange HTTP 500 when installing
Hi,

With you setdebug.php : you set debug=2 and disable asset_manager

I think with only (one time test)
Code:
    'config'=>array(
        'debug'=>2,
        'debugsql'=>0,
        'use_asset_manager' => true,
    )
you have the line where it call empty asset

You do it one time, save HTML (to have whole process)
And set again 'use_asset_manager' => false, after

I check : to disable asset manager : you need YII_DEBUG to true and Yii::app()->getConfig('use_asset_manager') to false (default is false)
Code:
if (!YII_DEBUG || Yii::app()->getConfig('use_asset_manager')) {
  • fabionardecchia67
  • fabionardecchia67's Avatar
15 Nov 2023 09:33
Domande più colonne e diverse opzioni was created by fabionardecchia67
La tua versione di LimeSurvey: Versione 2.73.1+171220
==================
Buongiorno, sto creando una nuova indagine e mi è stato chiesto di inserire in un'unica domanda i tre allegati in foto.
In poche parole in questa domanda devo inserire più colonne tra cui due colonne dove chiedo il nome e il cognome della persona (solo testo) ed altre tre/quattro colonne dove la persona deve scegliere per esempio il lavoro che fa e il contratto che ha (menù dropdown).
Io negli anni precedenti lo avevo impostato in più domande ma quest'anno mi hanno richiesto tutto in un'unica domanda.
Non penso che Limesurvey permette di fare questa cosa se non modificando html o altro, purtroppo sono ignorante sull'argomento quindi volevo chiedervi un aiuto.
p.s. non posso aggiornare ad una versione più recente Limesurvey.
Grazie mille in anticipo!
  • Joffm
  • Joffm's Avatar
15 Nov 2023 00:12
What you can try is:
Create a HTML table with your desired layout in the Question text of a question of type "array"
One subquestion and as many answer option as there are images.
Now move the radio buttons into the question text by a script.

Here you get an idea.
Two rows with images of equal width.
Shouldn't be too difficult to adapt-
[url] forums.limesurvey.org/forum/can-i-do-thi...iple-question#250729 [/url]

Joffm
  • Taliyah-M
  • Taliyah-M's Avatar
13 Nov 2023 21:43 - 13 Nov 2023 21:44
Your LimeSurvey version: [url=http://localhost/limesurvey/index.php/admin/questions/sa/editquestion/surveyid/841573/gid/4/qid/7#modalSystemInformation]Version 3.28.76+231018[/url]
Own server or LimeSurvey hosting: Own Server
Survey theme/template: Fruity Theme
==================
I started using LimeSurvey for a Uni-Project a llittle bit ago - so i am not that used to coding in Html

For our project we ideally need a selection field where you can only choose 1 option from all the options. I'm thinking that Bootstrap Buttons would be best kind of Selection.
But in that selection field we have a different amount of possible answers in each row - but the row of the answer-option is relevant. 
Ive added an image with a drawing of the ideal layout.
I already learned how to put an image as an option, and in each row, the image would have a different width (therefore different amount of answers in each row)

Is it possible to have a different amount of answers in each row? I couldnt find anything online yet.
Im grateful for any help! 

 
  • Joffm
  • Joffm's Avatar
13 Nov 2023 16:26 - 13 Nov 2023 16:27
Replied by Joffm on topic Antwortmöglichkeiten als Abbildungen
Weil in den Antwortoptionen von "image select" nicht das Bild mittels <img src=".../> angezeigt wird, sondern es wird nur der Pfad zum Bild eingegeben.
[url] forums.limesurvey.org/forum/design-issue...ltiple-choice#251338 [/url]

So, jetzt etwas Generelles;  und warum ich zweimal erwähnte, 6 sei angenehmer gewesen.
Du weißt ja, dass LimeSurvey die bootstrap-Blbliothek für das Layout benutzt.
Diese basiert auf einem Gitter, das jeden Container in bis zu 12 Spalten unterteilt, von denen dann jede wieder in 12 Spalten unterteilt werden können.
Daher siehst Du auch (wenn Du "bootstrap-buttons" als Fragevorlage benutzt), dass Du zwischen 1,2,3,4,6,12 Buttons/pro Zeile wählen kannst.
Eben die Teiler von 12.

Langer Rede kutzer Sinn.
Um 7 Bildchen nebeneinander darzustellen, musst Du "12 Spalten " angeben; dann bleibt rechts eben ziemlich viel frei.

Und der Rahmen ist überdimensioniert.
Gut ein bisschen css hilft
Code:
<style type="text/css">li.imageselect-listitem .imageselect-container .imageselect-label
  {
    border: 3px solid hsla(0,0%,60%,0.9);
}
li.imageselect-listitem .imageselect-container input.imageselect-checkbox:checked+label {
    border: 3px solid rgb(255,0,0,0.9);
}
  .radio-item input[type="radio"]:checked + label::after {
    display:none;
}
</style>


Du siehst, ich habe die Farbe des Rahmens einmal in hsl-Syntax, einmal in rgb-Syntax angegeben.
Nimm, was Dir besser gefällt!
Und, wenn Du keinen Wert auf Durchsichtigkeit legst, eben einfach hex.
Findest Du bei "W3Schools"
[url] www.w3schools.com/html/html_colors.asp [/url]

Wie Du siehst ist es etwas fitzelig
   

Der Vergleich (nur 6 Bilder).


Aus diesem Grund würde ich diesen Fragetyp nicht nehmen, sondern doch eher eine Matrix.
So wie diese hier
 
Einfach mit css die Rähmchen entfernt.
Code:
<style type="text/css">
  .fruity .table-bordered>tbody>tr>th,
  .fruity .table-bordered>tbody>tr>td,
  .fruity .table-bordered>thead>tr>th,
  .fruity .table-bordered>thead>tr>td,
  .fruity .table-bordered {
    border: 0;
}
</style>


Joffm


 
  • bdbp23
  • bdbp23's Avatar
11 Nov 2023 02:07 - 11 Nov 2023 02:09
Automate Exporting Uploaded Files was created by bdbp23
Please help us help you and fill where relevant:
Your LimeSurvey version: 6.0.0+230405
Own server or LimeSurvey hosting: Own server, dev run in docker
Survey theme/template: vanilla
==================
I have a survey where among other things users upload an image.

I've built a custom plugin to hit a specific webhook with the survey answers for processing on submit, but am not sure how to automate exporting the images resources that get uploaded.

I've reviewed the methods available here .

When I look at the data for that question in getResponse() it looks like I'd have to rename the file located at upload/surveys/999999/files with a name and extension myself:
Code:
[{ "title":"","comment":"","size":"44.3056640625","name":"test-file.png","filename":"fu_r9f47ruw4z7t5aa","ext":"png" }]

Am I missing an existing method to cut down on that work?
Displaying 136 - 150 out of 4728 results.

Lime-years ahead

Online-surveys for every purse and purpose