Welcome to the LimeSurvey Community Forum

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

Search Results (Searched for: isNumeric)

  • Joffm
  • Joffm's Avatar
11 Mar 2024 18:30
Ich habe übrigens das erwähnte script-snippet gefunden.

Wenn Du dies
nach dem Block  // Returning to page und
vor //Clean up styles einfügst, werden Nicht-Ziffern einfach direkt wieder gelöscht.
Code:
      // Listener on column 5 inputs
      $('.answer-item.answer_cell_X005 input:text', thisQuestion).on('keyup change', function(e) {
        var thisValue = $.trim($(this).val());
         
        // Numerics only
        if($.isNumeric(thisValue) === false) {
         
          // Strip out non-numerics characters
          newValue = thisValue.replace(/\D/g,'');
          $(this).val(newValue).trigger('change');
        }
      });
 // Clean-up styles

Dann ist keine Validierung nötig.

Joffm
 
  • Joffm
  • Joffm's Avatar
21 Apr 2023 21:54 - 21 Apr 2023 21:55
Hola,
para los "Otros"
este parte del script
Code:
      // 4rd column conditional on 3nd column
      if($(this).closest('.answer-item').hasClass('answer_cell_SQ003')) {
         handleColumnSQ004($(this));
      }
    });
 
    function handleColumnSQ004(thisSelect) {
      var thisRow = $(thisSelect).closest('tr.subquestion-list');
      var item4 = $('.answer_cell_SQ004', thisRow);
 
      if($(thisSelect).val() == '4') {
        $('input:text', item4).prop('disabled', false);
      }
      else {
        $('input:text', item4).val('').prop('disabled', true);
        $('input:text', item4).val('').trigger('change');
      }
    }

Tienes otra idea?

Y los numeros?
este parte
Code:
   // Listener on column 6 inputs
      $('.answer-item.answer_cell_SQ006 input:text', thisQuestion).on('keyup change', function(e) {
        var thisValue = $.trim($(this).val());
 
        // Numerics only
        if($.isNumeric(thisValue) === false) {
 
          // Strip out non-numerics characters
          newValue = thisValue.replace(/\D/g,'');
          $(this).val(newValue).trigger('change');
        }


 

Y ves las columnas de anchura diferente?
Este script
Code:
<script type="text/javascript" charset="utf-8">
  $(document).on('ready pjax:scriptcomplete',function(){
    var thisQuestion = $('#question{QID}');
    // Add a question class
    thisQuestion.addClass('custom-array');
 
    // Column-specific classes
    $('table.subquestion-list tr', thisQuestion).each(function(i) {
      $('th, td', this).each(function(i) {
        $(this).addClass('column-'+i);
      });
    });
  });
</script>
<style type="text/css">.custom-array table.subquestion-list col {
    width: auto !important;
  }
  .custom-array table.subquestion-list thead .column-0 {  width: 4%; }
  .custom-array table.subquestion-list thead .column-1 {  width: 20%; }
  .custom-array table.subquestion-list thead .column-2 {  width: 20%; }
  .custom-array table.subquestion-list thead .column-3 {  width: 10%; }
  .custom-array table.subquestion-list thead .column-4 {  width: 20%; }
  .custom-array table.subquestion-list thead .column-5 {  width: 17%; }
  .custom-array table.subquestion-list thead .column-6 {  width: 9%; }
</style>

Puedes cambiar como quieres.

 

File Attachment:

File Name: limesurvey...5_JK.lss
File Size:37 KB


Joffm

 
Displaying 1 - 2 out of 2 results.

Lime-years ahead

Online-surveys for every purse and purpose