0

When I clone the rows of a dynamic html table with Javascript and try to fetch the data in each row in the Java Spring MVC Controller, the data does not come.

My jsp and Javascript code :

<script type="text/javascript">
    function patBasTesBosTabloSatirEkle() {
        document.getElementById("trPatBasTescTablosunuOlusturmakİcinSatirEkle").value = "Tabloya Satır Ekle";
        if(document.getElementById("ticarilesmeRaporuPatentBasvuruTescilleri_empty").style.display=="none"){
            document.getElementById("ticarilesmeRaporuPatentBasvuruTescilleri_empty").style.display = "";
        }else{
            var x = document.getElementById('ticarilesmeRaporuPatentBasvuruTescilleri_empty');
            var new_row = x.rows[1].cloneNode(true);
            var len = x.rows.length;
            x.style.display = "";
            var inp0 = new_row.cells[0].getElementsByTagName('input')[0];
            inp0.value = '';
            var inp1 = new_row.cells[1].getElementsByTagName('input')[0];
            inp1.value = '';
            x.appendChild(new_row);
        }
      }
</script>

<div class="set-form">
    <table id="ticarilesmeRaporuPatentBasvuruTescilleri_empty" class="veriListeTablo table table-bordered" style="display:none">
        <thead>
            <tr>
              <td align="center" style="display:none;">Id</td>
              <td align="center">Buluş Başlığı</td>
            </tr>
        </thead>
        <tr>
            <td style="display:none;"><input type="text" class="textbox" name="patBasTesId[]" id="patBasTesId[]" value=""/></td>
            <td><input type="text" class="textbox" name="basvuruBasligi[]" id="basvuruBasligi[]" value=""/></td>
            </tr>
    </table>
    <br>
    <input type="button" value="Tablo Oluştur"  id="trPatBasTescTablosunuOlusturmakİcinSatirEkle" onclick="patBasTesBosTabloSatirEkle()" />
</div>

My Controller Codes:

String [] basvuruBasliklari = (String[])request.getParameterValues("basvuruBasligi[]");

Finally I want to get data for input called "basvuruBasliklari" but I can't. Only the data in the row with display="none" property is coming. The data in the second clone row is not coming.

Please help me. Thank you.

Hilal
  • 1
  • Hello, I solved the problem. Since there is an unclosed tag in the
    ....
    tags in my .jsp file, the table row cloned with the script cannot be retrieved with the request in the Controller. Tags in .jsp need to be closed correctly.
    – Hilal Nov 16 '22 at 06:52

0 Answers0