This topic is locked

Put calculated field in a table in javascript

2/23/2009 8:59:36 AM
PHPRunner General questions
S
sickacid author

Hi!,

with this code i calculate on the fly the value of 'KmPercorsi' field, and that works!

but i want to put the results in the table, what's the best way to do this?
<script>
var x = document.editform.value_KmFine;

x.onchange = x.onkeyup = function() {

var Inizio = document.editform.value_KmInizio.value;

var Fine = document.editform.value_KmFine.value;

document.editform.value_KmPercorsi.value = Fine - Inizio;

document.forms.editform.value_KmPercorsi.disabled=true;

}
</script>

G
garethpDevClub member 2/23/2009

Hi
You will need to do before record edit and before record edited events to update the record in the table...
$values["zzz"] = $values["xxx"]$values["yyy"];
replace zzz, xxx,yyy with your fields names.
hope this helps.
Gareth