0

I have a HTML table and its fields are automatically filled by a external application (sensor datas from a Labview application) and they change their value every 700 ms. I want to get these values and manipulate them (inserting in a database, or some math operations). I've tried to use Javascript "getElementById" with "onchange" and "oninput" event and it didn't work.

Example of HTML field:

<td><input type='number' class='numeric' id='pressao1' oninput="getCurrentValue()" disabled ></td> 

The field must be disabled, because I just want to exhibit.

The Javascript code is very simple:

<script>
function getCurrentValue(){

var teste = document.getElementById("pressao1").value

document.getElementById("demo").innerHTML = "Valor capturado de pressão 1: " + teste;
}
</script>

And I put just a

element to test if I got the value and its change:

<p id="demo"></p>

I'm thinking to use an autorefresh with a timer, but I guess I will lose some value and its not a clever solution.

Something like this:

<meta http-equiv="refresh" content="0.7; URL=XXXX">

If there is any solution with PHP, instead of Javascript, it's ok too.

Thanks in advance.

  • "_automatically filled by a external application_" how? browser extension? – Vinay Jan 10 '19 at 17:44
  • @Viney Hi Viney, its a web service from LabView. I associate a HTML ID with the sensor measure, so the LabView recognize the "pressao1" ID and know wherer to insert its value. Every time it read a measure, the value is written in the field. – Luiz Carlos Macedo Jan 11 '19 at 10:48
  • I see, if the values are being modified programmatically then no event would be fired but you use mutation api to observe/monitor any dom changes see [here](https://stackoverflow.com/q/648996/6160662) more – Vinay Jan 12 '19 at 03:05

0 Answers0