User Input of Numbers with Decimals Generating Dataset Error on Save

I need to allow users enter decimal numbers into a dataset, for latitude and longitude, but I am getting the following error message when the dataset tries to save:

“save operation failed: DatasetError: Some of the elements validation failed.”

When I check the .valid property of my input boxes in debugging, they show as invalid when they contain any number with a decimal place.

The fields in my collection are defined as numbers, and on my page I am using text input boxes with input type set to Number. There is no regex pattern validation.

I can manually type numbers with decimals into my collection just fine, and I can also save numbers without decimals from my page just fine, including negative numbers.

Any suggestions?

I know I could save as text and convert to numbers on read, but that seems hokey.

Thank you!

Hi Tim,

I encountered this same problem a few weeks ago. I was surprised to find out that I had to change the input type to “text” to get it to pass validation. Thankfully, I didn’t have to change the field type in the collection editor to “text”.

Thanks Anthony, I’ll give that a try. Really appreciate it!

This was also a concern for me also, However you can remedy this by simply changing input to text but keep all your calculation and collection as numbers and you should be able to save decimal points flawlessly, Hope it works for you!

Hey there! It seems you have he answer, but I’m trying to understand your comment.

So, I should change the input to text, but keep all my calculations as numbers.

How do I do this? Thanks! :slight_smile:

Convert from STRING to NUMBER…

var myString= “222”
var myNumber = Number(myString)