Using field input of forms for calculation

Question:
I want to use the information given by the user through the form to calculate a value. How Do I proceed?

Product:
I am using Wix Studioe

What are you trying to achieve:
The form basically takes users’ height, weight, age and activity level to determine their daily calorie intake for fat loss.

What have you already tried:
I tried using automations but I keep getting errors. ( It doesn’t show which error it is)

Hi, @Yadav_Sitaram !!

Hi, If you want to run the calculation while the user is filling out the form (before submission), you can try using onFieldValueChange(). Alternatively, if you want to perform the calculation after the form has been submitted, then using onSubmit() would be the way to go. :smiling_face_with_sunglasses:

Thanks for the reply but where do I code it exactly, within the form automation(i.e add velo logic) or something else?

If you’re using Velo (SDK) :thinking:, you’ll need to write the code in the page code section of the page where the form element is placed. If you’re new to Velo, this link should give you a good understanding of the basics. I’ve also included links to the APIs that seem relevant to the functionality you need. :innocent:

1 Like

I understand it now, thanks a lot.

1 Like

Checkout this channel. This has a bunch of calculator tutorials created on Wix using Velo: