console.log(valueOf($w(“#input4”)))
“#input4” is a number field data entry user in a form. When I save it with $w(“#input4”).value, it save it in the collection as a text. That’s an issue because the field type in the collection is a number.
the valueOf() worked perfectly, but than I start getting the error “Cannot convert undefined or null to object”.
How I can get a numeric value?
Hello Shimon,
you can get the value of an input element using $w(" #input4 ").value, and you can parse it into a numeric value using the function parseInt($w(" #input4 ").value, 10);
More on parseInt() - here
Goodluck,
Majd
Thanks a lot. It’s working perfectly.
My pleasure