Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
4 Odpovědi
4525 Zobrazení
<t t-foreach="values" t-as="value">
<input type="hidden" t-att-value="value.editor1" id="aaa"/>

<script type="text/javascript">

var a= document.getElementById("aaa").value;

alert(a);
document.getElementById("kkkr").innerHTML = a;
</script>

<span id="kkkr"> </span>

here iam getting only first record every time

How to get all records present in the table
Avatar
Zrušit

log your values, whether its a dict or record

Autor

Yes these are dict values

I am getting only first record of table

Autor

Every time pf fpr loop my javascript getting only first recod insted of pointing to next id

Nejlepší odpověď

In your example foreach has every time the same input tag with id = "aaa". Many input lines (not array), but only one id. In this case Method

getElementById("aaa")

returns each time the value of the first line.   Change it to ... for example:  'aaa' + value.id
or organise as array.

 


Avatar
Zrušit
Related Posts Odpovědi Zobrazení Aktivita
2
čvn 24
1534
1
pro 23
1252
1
dub 23
1438
1
bře 23
2270
0
pro 22
1850