Answers.Body: <p>Just tested this on a local Craft3 setup and here's what I discovered...</p>
  
  <p>If the <code>decimal points</code> setting on the number field is set to <code>0</code>, adding text in the number field will display the pretty errors below:</p>
  
  <p><a href="https://i.sstatic.net/h5vkx.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/h5vkx.png" alt="enter image description here"></a></p>
  
  <p>If the <code>decimal points</code> setting is set to anything else, you get the Twig error mentioned in the title of this post:</p>
  
  <blockquote>
    <p>number_format() expects parameter 1 to be float, string given</p>
  </blockquote>
  
  <p>I'd recommend opening an issue in the <a href="https://github.com/craftcms/cms/issues?q=is%3Aissue%20is%3Aopen%20sort%3Aupdated-desc" rel="nofollow noreferrer">Craft CMS repo</a> as I imagine the number field ought to display the pretty errors no matter if <code>decimal points</code> is set or not.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-10-31T15:46:55.193Z
Answers.Text: Issue is here for anyone else reading this thread. https://github.com/craftcms/cms/issues/3416
Answers.UserDisplayName: Chattervast
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-10-31T15:30:56.010Z
Answers.LastActivityDate: 2018-10-31T15:30:56.010Z
Answers.UserDisplayName: Jalen Davenport
Body: <p>Craft 3 is giving me this error when my client enters non-numeric characters into a number field on an entry:</p>
  
  <blockquote>
    <p>number_format() expects parameter 1 to be float, string given</p>
  </blockquote>
  
  <p>Is there a way for it to check and remove non-numeric characters from the field on save? Or maybe my setup is incorrect?</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2018-10-31T15:22:15.390Z
Comments.Text: Is it an error or an exception? Because it actually should display errors rather than removing the characters. You could create a custom field that strips all letters from the input
Comments.UserDisplayName: Robin Schambach
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2018-10-31T15:25:46.690Z
Comments.Text: Per an image my client sent: PHP Warning - yii\base\ErrorException
Comments.UserDisplayName: Chattervast
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2018-10-31T15:26:33.660Z
Comments.Text: Shouldn't craft handle this natively? Either not allowing non-numeric characters in number fields or something?
Comments.UserDisplayName: Chattervast
Tags: <craft3><entry><field><number>
Title: Non-numeric characters in number field producing errors
ThreadText: # Non-numeric characters in number field producing errors
  
  (Asked by: username_0 on 2018-10-31)
  
  Craft 3 is giving me this error when my client enters non-numeric characters into a number field on an entry:
  
  > number\_format() expects parameter 1 to be float, string given
  
  Is there a way for it to check and remove non-numeric characters from the field on save? Or maybe my setup is incorrect?
  
  **Tags:** craft3, entry, field, number
  
  > **Comments:**
  > **username_1**: Is it an error or an exception? Because it actually should display errors rather than removing the characters. You could create a custom field that strips all letters from the input  
  > **username_0**: Per an image my client sent: PHP Warning - yii\base\ErrorException  
  > **username_0**: Shouldn't craft handle this natively? Either not allowing non-numeric characters in number fields or something?  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_2 on 2018-10-31. Score: 3 | Accepted answer
  
  Just tested this on a local Craft3 setup and here's what I discovered...
  
  If the `decimal points` setting on the number field is set to `0`, adding text in the number field will display the pretty errors below:
  
  [![enter image description here](https://i.sstatic.net/h5vkx.png)](https://i.sstatic.net/h5vkx.png)
  
  If the `decimal points` setting is set to anything else, you get the Twig error mentioned in the title of this post:
  
  > number\_format() expects parameter 1 to be float, string given
  
  I'd recommend opening an issue in the [Craft CMS repo](https://github.com/craftcms/cms/issues?q=is%3Aissue%20is%3Aopen%20sort%3Aupdated-desc) as I imagine the number field ought to display the pretty errors no matter if `decimal points` is set or not.
  
  > **Comments:**
  > **username_0**: Issue is here for anyone else reading this thread. https://github.com/craftcms/cms/issues/3416  
  
  ---
  
  