Passa al contenuto
Menu
È necessario essere registrati per interagire con la community.
La domanda è stata contrassegnata
4 Risposte
4860 Visualizzazioni
<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
Abbandona

log your values, whether its a dict or record

Autore

Yes these are dict values

I am getting only first record of table

Autore

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

Risposta migliore

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
Abbandona
Post correlati Risposte Visualizzazioni Attività
2
giu 24
1836
1
dic 23
1569
1
apr 23
1692
1
mar 23
2527
0
dic 22
2112