Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to set javascript on a dynamic array?
    primarykey
    data
    text
    <p>I am working on a dynamic array inside a table which means the table appears based on user input. Users need to fill this table and then click submit. I need to place javascript here to check if the user didn't select anything or didn't write in any column. If so, the user should not be able to proceed.</p> <pre><code>&lt;form action="klr.php" method="post" name="myform" &gt; &lt;?php for ($i = 1; $i &lt;= $de; $i++) { ?&gt; &lt;tr&gt; &lt;td&gt;Tube&lt;/td&gt; &lt;td&gt; &lt;select id="in4-&lt;?php echo $i; ?&gt;" name="t1[&lt;?php echo $i; ?&gt;]" onclick="getText3(&lt;?php echo $i; ?&gt;)" onchange="getText39(&lt;?php echo $i; ?&gt;)" onmouseout="getText89(&lt;?php echo $i; ?&gt;)"&gt; &lt;option value="0"&gt;0&lt;/option&gt; &lt;option value="12"&gt;12&lt;/option&gt; &lt;option value="18"&gt;18&lt;/option&gt; &lt;option value="24"&gt;24&lt;/option&gt; &lt;option value="75"&gt;75&lt;/option&gt; &lt;/select&gt; &lt;/td&gt; &lt;td&gt; &lt;input type="text" name="t2[&lt;?php echo $i; ?&gt;]" id="in1-&lt;?php echo $i; ?&gt;" onblur="getText3(&lt;?php echo $i; ?&gt;)" onchange="getText39(&lt;?php echo $i; ?&gt;)" onmouseout="getText89(&lt;?php echo $i; ?&gt;)"/&gt; &lt;/td&gt; &lt;td&gt; &lt;select name="a1[&lt;?php echo $i; ?&gt;]" id="in2-&lt;?php echo $i; ?&gt;" onclick="getText3(&lt;?php echo $i; ?&gt;)"onchange="getText39(&lt;?php echo $i; ?&gt;)" onmouseout="getText89(&lt;?php echo $i; ?&gt;)" &gt; &lt;option value="0"&gt;0&lt;/option&gt; &lt;option value="1"&gt;1&lt;/option&gt; &lt;option value="2"&gt;2&lt;/option&gt; &lt;option value="3"&gt;3&lt;/option&gt; &lt;option value="4"&gt;4&lt;/option&gt; &lt;option value="5"&gt;5&lt;/option&gt; &lt;option value="6"&gt;6&lt;/option&gt; &lt;option value="7"&gt;7&lt;/option&gt; &lt;option value="8"&gt;8&lt;/option&gt; &lt;option value="9"&gt;9&lt;/option&gt; &lt;option value="10"&gt;10&lt;/option&gt; &lt;option value="11"&gt;11&lt;/option&gt; &lt;option value="12"&gt;12&lt;/option&gt; &lt;/select&gt; &lt;/td&gt; &lt;/table&gt; </code></pre> <p>I only provided the code of the first row of the table in which the user selects values. In the second column users can enter some values and in the third column users can select a value again. I need to place javascript in three of these columns</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.
 

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