Note that there are some explanatory texts on larger screens.

plurals
  1. POAnswer Buttons (True, False, Yes and No) are not appearing
    primarykey
    data
    text
    <p>I am having trouble display "True", "False", "Yes" and "No" buttons in a appended row.</p> <p>I have an application here: <a href="http://helios.hud.ac.uk/u0867587/Mobile_app/QandATable2.php" rel="nofollow">Application</a></p> <p>Please follow these steps in order to use application: </p> <p><strong>1. When you open application, you will see a green plus button, click on this button, a modal window will appear with a search bar inside.</strong></p> <p><strong>2. In the search bar type in the following "orange" (without double quotes) and then submit the search.</strong></p> <p><strong>3. A row will appear matching the term from the search with the term under the "Question" column. You will see that under the "Answer" column that the answer is "True". Please click on the "Add" button to add the contents from the row.</strong></p> <p><strong>4. You will see that on the right hand side, that it displays the "True" and "False" buttons and that the "True" button is highlighted green. This is fine.</strong></p> <p>But below is where the problem occurs:</p> <p><strong>1. Click on the "Add Question" button, this will append a row underneath and will copy the controls from above.</strong></p> <p><strong>2. Now within the row you have just appended you will see another green plus button, click on this button and perform steps 2 and 3 again.</strong></p> <p>You can see that within the appended row, that it does not display the "True" or "False" buttons at all. So my question is that within an appended row, how come when I add a question from the modal window, that it does not display the "True" or "False" buttons if the answer is "True" or "False"? This also happens with the "Yes" and "No" buttons as well.</p> <p>The whole code is displayed in the jsfiddle here (The functions which opens the modal window is at the bottom of the javascript section of the fiddle): </p> <p><a href="http://jsfiddle.net/WZKrP/6/" rel="nofollow">http://jsfiddle.net/WZKrP/6/</a> </p> <p>CODE:</p> <pre><code>function plusbutton(plus_id) { // Set global info plusbutton_clicked = plus_id; // Display an external page using an iframe var src = "previousquestions.php"; $.modal('&lt;iframe src="' + src + '" style="border:0;width:100%;height:100%;"&gt;'); return false; } function addwindow(numberAnswer, gridValues, btn) { if (btn == "True" || btn == "False" || btn == "Yes" || btn == "No") { var answers = '#answer' + btn; var answersrow = '#answer' + btn + 'Row'; } else { var answers = $.map(btn.split(''), function(chr) { return "#answer" + chr; }).join(', '); var answersrow = $.map(btn.split(''), function(chr) { return "#answer" + chr + "Row"; }).join(', '); } var myNumbers = {}; myNumbers["True or False"] = "True or False"; myNumbers["Yes or No"] = "Yes or No"; gridValues = myNumbers[gridValues]; if ($(plusbutton_clicked).attr('id') == 'mainPlusbutton') { if (gridValues == "True or False") { $('#btn' + 'TrueorFalse').trigger('click'); } else if (gridValues == "Yes or No") { $('#btn' + 'YesorNo').trigger('click'); } $('#answerSection').find('.answerBtnsOn').trigger('click'); $(answers).trigger('click'); } else { if (gridValues == "True or False") { $(plusbutton_clicked).closest('tr').find('input.gridTxtRow').val(gridValues).parent().append($('.optionTypeTbl')); $('#btn' + 'TrueorFalse').trigger('click'); } else if (gridValues == "Yes or No") { $(plusbutton_clicked).closest('tr').find('input.gridTxtRow').val(gridValues).parent().append($('.optionTypeTbl')); $('#btn' + 'YesorNo').trigger('click'); } } $('#btn' + gridValues).trigger('click'); $(plusbutton_clicked).closest('tr').find('.answerBtnsOn').trigger('click'); $(plusbutton_clicked).closest('tr').find(answersrow).trigger('click'); $.modal.close(); return false; }​ </code></pre> <p>HTML for top plusbutton:</p> <pre><code>&lt;table id="question"&gt; &lt;tr&gt; &lt;td colspan="2"&gt; &lt;a onclick="return plusbutton();"&gt; &lt;img src="Images/plussign.jpg" width="30" height="30" alt="Look Up Previous Question" class="plusimage" id="mainPlusbutton" name="plusbuttonrow"/&gt; &lt;/a&gt; &lt;span id="plussignmsg"&gt;(Click Plus Sign to look up Previous Questions)&lt;/span&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; </code></pre> <p>Below is jquery code where it appends a plusbutton for each row:</p> <pre><code>$('.plusimage').each( function() { var $this = $(this); var $plusimagerow = $("&lt;a onclick='return plusbutton(this);'&gt;&lt;img src='Images/plussign.jpg' width='30' height='30' alt='Look Up Previous Question' class='imageplus'/&gt;&lt;/a&gt;").attr('name',$this.attr('name')+"[]") .attr('value',$this.val()); $plusrow.append($plusimagerow); }); </code></pre>
    singulars
    1. This table or related slice is empty.
    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. 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