Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>There is another solution, but I'm under the impression you won't like it very much... you can use a single form for the whole datatable (wrapping the whole table in a form is permitted) generate input fields for the current row and if it's updated submit the form asyncronously with javascript and restore td contents to the original html, if you name your fields such as name="field[]" you can also submit multiple rows at a time (I don't know if you'd want that though).</p> <p>You can write html code such as</p> <pre><code>&lt;form action=""&gt; &lt;table&gt; &lt;tr&gt;&lt;td&gt;&lt;input type="hidden" name="row[]" value="1"/&gt;&lt;input name="field[]"/&gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt;&lt;td&gt;field value for row2&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt;&lt;td&gt;&lt;input type="hidden" name="row[]" value="3"/&gt;&lt;input name="field[]"/&gt;&lt;/td&gt;&lt;/tr&gt; &lt;/table&gt; &lt;/form&gt; </code></pre> <p>you can just grab the form with jquery and submit it via xmlhttprequest as I suspect you would if each row was a separate form (which is illegal), if you don't want multiple rows, just remove the [] and submit each row and upon submitting the values you get them numbered correctly, don't know exactly how it would behave in java but in php I'd get the following:</p> <pre><code>$_GET[row][0] = 1; $_GET[field][0] = 'value typed in row1'; $_GET[row][1] = 3; $_GET[field][1] = 'value typed in row3'; </code></pre> <p>Alternative table definition to avoid having the same name again</p> <pre><code>&lt;form action=""&gt; &lt;table&gt; &lt;tr&gt;&lt;td&gt;&lt;input name="field[1]"/&gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt;&lt;td&gt;field value for row2&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt;&lt;td&gt;&lt;input name="field[3]"/&gt;&lt;/td&gt;&lt;/tr&gt; &lt;/table&gt; &lt;/form&gt; </code></pre> <p>It's the same table as above only you set explicit indexes for each entry thus avoiding duplicate names in the response, preferrably use a unique identifier which can describe the row from the table that you're modifying in there (when possible I use the primary key) instead of the row number, just in case that wasn't clear enough.</p>
 

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