# The value does not match the field type Number when null value

**URL:** <https://forum.wixstudio.com/t/the-value-does-not-match-the-field-type-number-when-null-value/7754>\
**Category:** Ask the community\
**Tags:** cms, question, code\
**Created:** [December 31, 2020, 12:32am UTC](https://forum.wixstudio.com/t/the-value-does-not-match-the-field-type-number-when-null-value/7754 "2020-12-31T00:32:58Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![miguel-galvez](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/miguel-galvez/32/1293_2.png) [@miguel-galvez](https://forum.wixstudio.com/u/miguel-galvez)\
**Post date:** [December 31, 2020, 12:32am UTC](https://forum.wixstudio.com/t/the-value-does-not-match-the-field-type-number-when-null-value/7754/1 "2020-12-31T00:32:58Z")

</div>

I have a form with a rating input box. It is not a required field. I’ve noticed that if the user leaves it blank, I get an exclamation mark in the content manager with the following message: “The value does not match the field type Number”. It gives me the option to convert in which it changes the value to 0 or to clear the content.

I would like to leave it blank if the user does not enter any number in the input box. How would I do that?

---

<div class="post-metadata">

**Author:** ![giri-zano](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/giri-zano/32/80469_2.png) [@giri-zano](https://forum.wixstudio.com/u/giri-zano)\
**Post date:** [January 1, 2021, 3:26pm UTC](https://forum.wixstudio.com/t/the-value-does-not-match-the-field-type-number-when-null-value/7754/2 "2021-01-01T15:26:12Z")

</div>

It’s prob because that input box returns a string, in this case an empty string, but still a string (and in your collection the field is a number, I guess). Just test more or less like so:

```javascript
if(!$w('#someinput').value ){$w('#someinput').value = undefined };

```

This replaces an empty string with undefined, which is allowed in a collection number field.

---

<div class="post-metadata">

**Author:** ![miguel-galvez](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/miguel-galvez/32/1293_2.png) [@miguel-galvez](https://forum.wixstudio.com/u/miguel-galvez)\
**Post date:** [January 1, 2021, 10:36pm UTC](https://forum.wixstudio.com/t/the-value-does-not-match-the-field-type-number-when-null-value/7754/3 "2021-01-01T22:36:57Z")

</div>

Yes, that seems to be the problem. Is that a feature or a bug? It seems to me that if the input box is set to accept only numbers it should return undefined if it is left blank.

Anyway, I did something similar to what you proposed. When the page loads I used setFieldValue to force undefined. That way if it is left blank it won’t give a mismatch error.

```javascript
$w('#dataset1').setFieldValue("rating", undefined);

```

---

<div class="post-metadata">

**Author:** ![giri-zano](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/giri-zano/32/80469_2.png) [@giri-zano](https://forum.wixstudio.com/u/giri-zano)\
**Post date:** [January 2, 2021, 8:30pm UTC](https://forum.wixstudio.com/t/the-value-does-not-match-the-field-type-number-when-null-value/7754/4 "2021-01-02T20:30:47Z")

</div>

It is documented as such, so it’s a feature, I guess, but I do agree that you would expect a numeric value instead of a string when input is set to Number. The element is called “TextInput”, so the “Number”-setting is just a check on input, not a change in return value.
