Why calculation in the form is not working properly?