Welcome to the LimeSurvey Community Forum

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

Separatore radio button

More
6 years 2 months ago #201341 by crimba
Fra le varie risposte dei radio button è possibile mettere un titolo, tipo una categoria, esempio:
Professione:

Imprenditore
- freelance
- imprenditore
lavoratore dipendente
- dirigente
- insegnante
non professioni
- studente
- pensionato
The topic has been locked.
More
6 years 2 months ago #201350 by Joffm
Replied by Joffm on topic Separatore radio button
Buongiorno,
Ho solo questa soluzione con una domanda multipla







Con questo javascript
Code:
<script type="text/javascript" charset="utf-8"> // A function to handle "secondary" checkboxes function secondaryCheckboxes(qID, primaryPosition, secondaryCount) { // Identify the elements var thisQuestion = $('#question'+qID); var primaryRow = $('li.question-item:eq('+(primaryPosition-1)+')', thisQuestion).closest('li.question-item'); var primaryInput = $('input:checkbox', primaryRow); var secondaryRows = primaryRow.nextAll('li.question-item:lt('+(secondaryCount)+')'); var secondaryInputs = $('input:checkbox', secondaryRows); // Indent the secondaries secondaryRows.css({ 'margin-left':'2.5em' }); // Initial states of the secondary answers if (primaryInput.prop('checked') == false ) { secondaryRows.hide(); } // A listener on the primary answer to show or hide secondary answers primaryInput.on('change', function (event) { // Hide/show the secondary answers accordingly if (!$(this).is(':checked')) { secondaryRows.hide(); secondaryInputs.prop('checked', false).trigger('change'); } else { secondaryRows.show(); } }); } $(document).ready(function() { // Sub-question 1 is primary followed by 2 secondaries secondaryCheckboxes({QID}, 1, 2); // Sub-question 4 is primary followed by 2 secondaries secondaryCheckboxes({QID}, 4, 2); // Sub-question 7 is primary followed by 2 secondaries secondaryCheckboxes({QID}, 7, 2); }); </script>

Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless
The following user(s) said Thank You: cesoielampo
The topic has been locked.
More
6 years 2 months ago #201377 by lfanfoni
Replied by lfanfoni on topic Separatore radio button
Senza scomodare JavaScript o altre soluzioni ad-hoc, io utilizzerei una tipologia scelta semplice dropdown con categorie, come nelle'esempio allegato che puoi importare nella tua survey (questa è in versione 3).
Nelle impostazioni avanzate della domanda (Visualizzare) devi definire un separatore di categoria, normalmente si usa il pipe (|). Quando imposti le opzioni di risposta, devi etichettare cosi': <nome_categoria>|<opzione_risposta>. Quindi, seguendo il tuo esempio dovresti mettere:
Imprenditore|freelance
Imprenditore|imprenditore
Lavoratore dipendente|dirigente
....

Se mi vuoi contattare, non mandare messaggi privati qui, bensì scrivi a lfanfoni at gmail.com
Per le livestream in italiano vai su: www.youtube.com/playlist?list=PLOSjjxAG9...SiiCsSz_JxIH7xJwLdPd
Le soluzioni LimeSurvey per l'Italia si trovano su: github.com/lfanfoni
The topic has been locked.
Moderators: lfanfoniholchtpartner

Lime-years ahead

Online-surveys for every purse and purpose