- Posts: 10219
- Thank you received: 3636
Ask the community, share ideas, and connect with other LimeSurvey users!
$('#question'+qID+' .answer_cell_004 input[type="text"]').hide().parent().hide();
$('#question'+qID+' .answer_cell_004 input[type="text"]').hide();
<script type="text/javascript" charset="utf-8"> $(document).ready(function() { var qID = {QID}; // Define the select element (dropdown) var select1 = '<select class="insertedSelect">\ <option value="">-- Please Choose --</option>\ <option value="Nuevo">Nuevo</option>\ <option value="Reparado">Reparado</option>\ <option value="Deteriorado">Deteriorado</option>\ <option value="Inservible">Inservible</option>\ </select>'; // Hide the text inputs $('#question'+qID+' .answer_cell_004 input[type="text"]').hide(); // Insert the select elements $('#question'+qID+' .answer_cell_004').append(select1); // Initially select an option if the question has already been answered $('#question'+qID+' .answer_cell_004 input[type="text"]').each(function(i){ if($(this).val()) { $(this).closest('td').find('.insertedSelect').val($(this).val()); } }); // Listener on the dropdowns - insert selected values into hidden text input $('.insertedSelect').change(function() { $(this).closest('td').find('input[type="text"]').val($(this).val()); }); }); </script>
<script type="text/javascript" charset="utf-8"> $(document).ready(function(){ $('#question{QID} .answer_cell_X1 option[value=1]').text('No recurro'); $('#question{QID} .answer_cell_X1 option[value=2]').text('Arocena Gustavo'); $('#question{QID} .answer_cell_X1 option[value=3]').text('Aspra Manuel'); $('#question{QID} .answer_cell_X1 option[value=4]').text('Bravo Ricardo'); $('#question{QID} .answer_cell_X1 option[value=5]').text('Zalazar Martin'); $('#question{QID} .answer_cell_X2 option[value=1]').text('No recurro'); $('#question{QID} .answer_cell_X2 option[value=2]').text('Bravo Ricardo'); $('#question{QID} .answer_cell_X2 option[value=3]').text('Fernandez Flavio'); $('#question{QID} .answer_cell_X2 option[value=4]').text('Zalazar Martin'); $('#question{QID} .answer_cell_X2 option[value=5]').remove(); }); </script>
Tony thanks for showing me the light. I was writting y-scale subquestion codes...tpartner wrote: I'm not sure you have correct jQuery selectors. If, for example, you have x-scale subquestion codes X1 and X2, the code should look like this (no need to replace {QID})
DenisChenu wrote: Hi,
Actually for such solution : you have a plugin : www.limesurvey.org/forum/plugins/104019-...ith-dropdwon-or-mask
It work on a 2.50 last time i tested.
See github.com/SondagesPro/LS-arrayTextAdapt...suecomment-223626556Juanoche wrote:
DenisChenu wrote: Hi,
Actually for such solution : you have a plugin : www.limesurvey.org/forum/plugins/104019-...ith-dropdwon-or-mask
It work on a 2.50 last time i tested.
DenisChenu I had already seen that plugin but unfortunately I get a 500 error on my server when I install it and try to acces survey settings / Plugins
<script type="text/javascript" charset="utf-8"> $(document).ready(function(){ $('#questionQQ .answer_cell_001 option[value=1]').text('No recurro'); $('#questionQQ .answer_cell_001 option[value=2]').text('Arocena Gustavo'); $('#questionQQ .answer_cell_001 option[value=3]').text('Aspra Manuel'); $('#questionQQ .answer_cell_001 option[value=4]').text('Bravo Ricardo'); $('#questionQQ .answer_cell_001 option[value=5]').text('Zalazar Martin'); $('#questionQQ .answer_cell_002 option[value=1]').text('No recurro'); $('#questionQQ .answer_cell_002 option[value=2]').text('Bravo Ricardo'); $('#questionQQ .answer_cell_002 option[value=3]').text('Fernandez Flavio'); $('#questionQQ .answer_cell_002 option[value=4]').text('Zalazar Martin'); $('#questionQQ .answer_cell_002 option[value=5]').text('').hide(); });