Hi,
I am using the following code for "Client side event".
I am using it for master detail and my master has 10 records.
Now when I change the record nr 1 then the record nr 10 is also changed too.
I am usig v2024.
{ // keys = event types, values = handler functions
"change": function(e) {
var $row = $(this).fields(); // Get an object of all fields, each property is a jQuery object of the input element(s) of a field
// Convert to number and validate 'gewichtung' is between 0 and 1
var gewichtung = parseFloat($row["gewichtung"].val()) || 0;
if (gewichtung < 0 || gewichtung > 1) {
alert("Gewichtung must be between 0 and 1."); // Alert, or handle the error as necessary
$row["score"].val('').prop('readonly', true); // Clear the score field or handle as necessary
return; // Exit the function if the 'gewichtung' is not within the range
}
// Convert to number and validate 'points' is between 0 and 100
var points = parseFloat($row["points"].val()) || 0;
if (points < 0 || points > 100) {
alert("Points must be between 0 and 100."); // Alert, or handle the error as necessary
$row["score"].val('').prop('readonly', true); // Clear the score field or handle as necessary
return; // Exit the function if the 'points' are not within the range
}
// If both 'gewichtung' and 'points' are valid, proceed with the calculation
var st = gewichtung * points; // Calculate
st = st.toFixed(2); // Format the score to have two digits after the decimal point
$row["score"].val(st).prop('readonly', true).css('text-align', 'right'); // Set the result to the 'score' field and make it read-only
}
}
mpol_ch