Overslaan naar inhoud
Menu
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Deze vraag is gerapporteerd
4 Antwoorden
4679 Weergaven
<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
Annuleer

log your values, whether its a dict or record

Auteur

Yes these are dict values

I am getting only first record of table

Auteur

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

Beste antwoord

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
Annuleer
Gerelateerde posts Antwoorden Weergaven Activiteit
2
jun. 24
1696
1
dec. 23
1398
1
apr. 23
1566
1
mrt. 23
2391
0
dec. 22
1977