Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The problem comes from the fact taht you're setting the data-attribute to false on the <code>$('#mainNumberAnswerTxt')</code> but you're checking against the inputs (<code>this</code> in the click).</p> <p>One solution would be to do the following test <code>if ($('#mainNumberAnswerTxt').attr('data-ignore') != true)</code></p> <p><strong>EDIT</strong></p> <p>To ensure that the ignore process execute only once (when the grid is reloaded after the modal), you'll have to change what's inside the block after the test:</p> <pre><code>if ($('#mainNumberAnswerTxt').data('ignore') != true) { $('.answertxt', context).val(context.find('.answerBtnsOn').length &gt; 0 ? context.find('.answerBtnsOn').length : 0); } else { /*reset the ignore flag*/ $('#mainNumberAnswerTxt').data('ignore',false); } </code></pre> <p><strong>EDIT2</strong> </p> <p>The main problem is that your reaffecting the <code>$('#mainNumberAnswerTxt').val(numberAnswer)</code> after setting it. Your trying to ignore it through the <code>ignore</code>attribute.</p> <p>What i would adivse, would be to remove every occurence to that attribute and to change the following function </p> <pre><code>function addwindow(questionText,textWeight,numberAnswer,gridValues,reply,btn) { var answers = $.map(btn.split(''),function(chr){ return "#answer"+chr; }).join(', '); if($(plusbutton_clicked).attr('id')=='mainPlusbutton') { var myNumbers = {}; myNumbers["A-C"] = "3"; myNumbers["A-D"] = "4"; myNumbers["A-E"] = "5"; myNumbers["A-F"] = "6"; myNumbers["A-G"] = "7"; gridValues = myNumbers[gridValues]; $('#mainNumberAnswerTxt').show(); $('#mainNumberAnswerTxt').val(numberAnswer).data('ignore',true); $('#mainGridTxt').val(gridValues).parent().append($('.optionTypeTbl')); $('#btn'+gridValues).trigger('click'); $('.answers.answerBtnsOn').removeClass('answerBtnsOn').addClass('answerBtnsOff'); $(answers).addClass("answerBtnsOn").siblings().addClass('answerBtnsOff'); } $.modal.close(); return false; } </code></pre> <p>to : </p> <pre><code>function addwindow(questionText,textWeight,numberAnswer,gridValues,reply,btn) { var answers = $.map(btn.split(''),function(chr){ return "#answer"+chr; }).join(', '); if($(plusbutton_clicked).attr('id')=='mainPlusbutton') { var myNumbers = {}; myNumbers["A-C"] = "3"; myNumbers["A-D"] = "4"; myNumbers["A-E"] = "5"; myNumbers["A-F"] = "6"; myNumbers["A-G"] = "7"; gridValues = myNumbers[gridValues]; $('#mainNumberAnswerTxt').show(); $('#mainGridTxt').val(gridValues).parent().append($('.optionTypeTbl')); $('#btn'+gridValues).trigger('click'); /* moved the following line below the click simulation, hence its value will be changed regardless of what happened during the click simulation*/ $('#mainNumberAnswerTxt').val(numberAnswer); $('.answers.answerBtnsOn').removeClass('answerBtnsOn').addClass('answerBtnsOff'); $(answers).addClass("answerBtnsOn").siblings().addClass('answerBtnsOff'); } $.modal.close(); return false; } </code></pre> <p>In order to modify the value after the visual changes took place.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload