Rogelio's picture

Hi, when the node form has a number field (integer, decimal or float) if you let it empty, it shows an error of invalid date time

error

SQLSTATE[22007]: Invalid datetime format: 1366 Incorrect integer value: '' for column `u540391360_test`.`test_field_data_field_cuenta`.`field_cuenta_value` at row 1

even with the Required option disabled

when the field is filled it works fine, tested in Backdrop 1.14.0 in a fresh install and another online site with the same result

for the moment i put "0" as default to avoid this

Most helpful answers

Actually seems to be https://github.com/backdrop/backdrop-issues/issues/3873 ...but it happens for any type of numeric field.

Comments

klonos's picture

I can confirm this, but in my case (non-required, decimal field, with default settings), the error was:

SQLSTATE[HY000]: General error: 1366 Incorrect decimal value: '' for column 'field_test_number_value' at row 1

thanks for reporting @rogelio and replicating @klonos

I first posted before refreshing! I see @klonos has found the core bug has already been filed: https://github.com/backdrop/backdrop-issues/issues/3873

I replicated with an integer field on `1.x`

      wid: 46
      uid: 1
     type: php
  message: %type: !message in %function (line %line of %file).
variables: a:6:{s:5:"%type";s:22:"EntityStorageException";s:8:"!message";s:156:"SQLSTATE[22007]: Invalid datetime format: 1366 Incorrect integer value: '' for column `backdrop`.`field_data_field_int`.`field_int_value` at row 1";s:9:"%function";s:29:"NodeStorageController->save()";s:5:"%file";s:38:"/app/core/modules/node/node.entity.inc";s:5:"%line";i:487;s:14:"severity_level";i:3;}
 severity: 3
     link:
 location: https://backdrop.lndo.site/node/add/page
  referer: https://backdrop.lndo.site/node/add/page
 hostname: 192.168.64.2
timestamp: 1574185564

we should file a bug against core and reference this original report (I've been meaning to, but have not found the time and will do so if someone does not beat me to it).  We can post back here w/ updates or when it is fixed against core.