Note that there are some explanatory texts on larger screens.

plurals
  1. POmulti-dimensional array element validation
    primarykey
    data
    text
    <p>i am using an multi-dimensional set of input elements Like :</p> <pre><code>&lt;input value="0" name="Base_fare[23][0]" onchange="javascript:basechanged(23,0)" type="text" id="Base_fare[23][0]" class="imputText2"/&gt; &lt;input value="0" name="Base_fare[24][0]" onchange="javascript:basechanged(24,0)" type="text" id="Base_fare[24][0]" class="imputText2"/&gt; &lt;input value="0" name="Base_fare[25][0]" onchange="javascript:basechanged(25,0)" type="text" id="Base_fare[25][0]" class="imputText2"/&gt; &lt;input value="0" name="Base_fare[23][15]" onchange="javascript:basechanged(23,0)" type="text" id="Base_fare[23][15]" class="imputText2"/&gt; &lt;input value="0" name="Base_fare[24][15]" onchange="javascript:basechanged(24,0)" type="text" id="Base_fare[24][15]" class="imputText2"/&gt; &lt;input value="0" name="Base_fare[25][15]" onchange="javascript:basechanged(25,0)" type="text" id="Base_fare[25][15]" class="imputText2"/&gt; &lt;input value="0" name="Base_fare[23][16]" onchange="javascript:basechanged(23,0)" type="text" id="Base_fare[23][16]" class="imputText2"/&gt; &lt;input value="0" name="Base_fare[24][16]" onchange="javascript:basechanged(24,0)" type="text" id="Base_fare[24][16]" class="imputText2"/&gt; &lt;input value="0" name="Base_fare[25][16]" onchange="javascript:basechanged(25,0)" type="text" id="Base_fare[25][16]" class="imputText2"/&gt; </code></pre> <p>i have stored the values to array by :</p> <pre><code>var Base_fare = new Array(3); Base_fare[23] = new Array(4); Base_fare[23][0]=parseFloat(document.getElementById('Base_fare[23][0]').value); Base_fare[23][15]=parseFloat(document.getElementById('Base_fare[23][15]').value); Base_fare[23][16]=parseFloat(document.getElementById('Base_fare[23][16]').value); Base_fare[23][17]=parseFloat(document.getElementById('Base_fare[23][17]').value); Base_fare[24] = new Array(4); Base_fare[24][0]=parseFloat(document.getElementById('Base_fare[24][0]').value); Base_fare[24][15]=parseFloat(document.getElementById('Base_fare[24][15]').value); Base_fare[24][16]=parseFloat(document.getElementById('Base_fare[24][16]').value); Base_fare[24][17]=parseFloat(document.getElementById('Base_fare[24][17]').value); </code></pre> <p>as the index were dynamic generated with php for-each loop so i have to use <code>$.each</code></p> <pre><code>$.each(Base_fare, function(key, value) { alert(key); }); </code></pre> <p>but it not returning 23 24 it is returning 1,2,3 like that i need to validate those finds</p> <p>what i want to do is sum thing like this</p> <pre><code>$.each(Base_fare, function(key, value) { $.each(Base_fare[key], function(key2, value2) { alert(key2 + ':' + value2); }); }); </code></pre> <p>so i can get each element's value to manipulate it and validate the fields but it is not working..</p> <p>can any one give me any solution or alternative solution .</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. 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