Questions and discussion about using ProcessMaker: user interface, running cases & functionality
By enttsh
#830147
hello
i used
$("form").setOnchange( function(newVal, oldVal)
var ....... = $("#......").getValue() ;
if ( (.......... )) {
$("#........").setValue(......);
}
else {
$("#........").setValue("");
}
});

in my dynaform and its ok

1)above code change the result if all the fields in the form changed but
i want to change the result only if field 1 or field 2 change
so i used:
$("#field1" or "#field2").setOnchange( function(newVal, oldVal)....
but it doesn't work !!
what should i do?

2-when i use
$("form").setOnchange( function(newVal, oldVal) .....1
and
$("form").setOnchange( function(newVal, oldVal) .....2
it doesn't work too !
how can i use 2 or more $("form").setOnchange in 1 dynaform?
thanks
By ayodelebamgboye
#830534
For questions 1
you can use the following code to change the result only when either field 1 or field 2 is changed

$("#field1, #field2").setOnchange(function(newVal, oldVal) {
var field1Value = $("#field1").getValue();
var field2Value = $("#field2").getValue();
if (field1Value === "some value" || field2Value === "some value") {
$("#resultField").setValue("new value");
} else {
$("#resultField").setValue("");
}
});

for question 2
$("form").setOnchange(function1);
$("form").setOnchange(function2);

function function1(newVal, oldVal) {
// Do something
}

function function2(newVal, oldVal) {
// Do something else
}

A 1xbet clone script is a pre-designed software so[…]

4rabet clone script is enabling entrepreneurs to e[…]

Parimatch clone script is enabling entrepreneurs t[…]

In the world of cryptocurrency, a wallet is an app[…]