Auto fill 2 form fields when a number is entered to another field

Is this possible? A form where the user fills in 1 field (amount you want to withdraw) and the other two fields are automatically filled in (calculated). Please see screenshot.

The “service fee” and the “amount you will receive” would both be automatically calculated. Then the user just has to click submit.

Thank you for you help.

Hi, Use onInput() function. Following code will help you.

$w("#withdraw").onInput( (event) => {
 let withdrawValue =;
 $w('#servicefee").value = withdrawValue * 0.01;
$w(#amountRecieve).value = (withdrawValue - $w('#servicefee").value);
} );

Rajjat thank you so much that worked perfectly.

1 Like

My pleasure, happy coding :slight_smile: