How to create onchange event when user edit on text box, ex: textbox A + textbox B = textbox C. So the value on textbox C is automatically filled when A or B changed. Thank's
OnChange Event when Edit Forms
-
- User
- Posts: 11741
Simply put the following code under: "Client Scripts" -> "Table-Specific" -> "Edit Page" -> "Startup Script":
$("#x_A").on('change keyup paste mouseup', function() {
$("#x_C").val($("#x_A").val() + $("#x_B").val());
});
$("#x_B").on('change keyup paste mouseup', function() {
$("#x_C").val($("#x_A").val() + $("#x_B").val());
});
-
- User
- Posts: 12
It's working now, I missed the check mark on Edit Page, previously i put it on the inline edit. Now it's working but the result is not exactly I want, I want the value on textbox C is sum of the A and B. Ex: A=2, B=3 so the value of C=5, but now the value of C is 23. Please how to fix this?
-
- User
- Posts: 12
it's working as expected now, after change the code from Mobhar :
$("#x_A").on('change keyup paste mouseup', function() {
$("#x_C").val(+$("#x_A").val() + +$("#x_B").val());
});
$("#x_B").on('change keyup paste mouseup', function() {
$("#x_C").val(+$("#x_A").val() + +$("#x_B").val());
});
Thank you.
-
- User
- Posts: 107
my field "sell" is a auto fill value (float type)
and field "amount" is for user to type in (integer type)
field "sumcost" is a result: (float type)
so my code is
$("#x_amount").on('change keyup paste mouseup', function() {
$("#x_sumcost").val(+$("#x_sell").val() * +$("#x_amount").val());
});
i put in in client script -> table-specific ->add/copy paste -->startup script
so do in the edit page too.
but when i run it don't matter. what wrong with it??