Number fields vs Text fields

I’m building a basic web app - and when I slide a Numeric field on the form, I have to convert the field from a string to a value like this:
numberPayment = val(loanYears.Text) * val(paymentsYear.Text)

and then after I do calculations I have to convert back to a string even to display in a numeric field.

Obviously I’m missing something easy, but I can’t find it in documentation.

str() will turn the double back into a string.
The documentation recommends that you use cdbl() if the string being converted comes from a user.

Yes, but why have to convert, or why have a Numeric field at all.

Because the input field uses strings. That’s just how things are, even on the desktop framework. You can’t do the math you want to do in your first post with strings, so you have to convert them to number values with cdbl() or val() (both of which return a double).

You might be misunderstanding what the Numeric field is. On the Web developers can specify what type of input a field is, and browsers optionally can filter and handle it or offer special controls for the data entry. Some browsers will even handle basic validation. It has nothing to do with your code, it’s for the user input.

For example, using Safari a Number field will show a stepper next to it which the user can use to change the value. (really it’s just to visually indicate that it’s a number field. don’t believe me? go ahead, enter 1,629 with a stepper.)

thanks - I got it and it’s working