Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with Number field #7917

Closed
olivierbon opened this issue May 11, 2021 · 1 comment
Closed

Issue with Number field #7917

olivierbon opened this issue May 11, 2021 · 1 comment
Labels

Comments

@olivierbon
Copy link
Member

Description

Number fields let you enter alphanumerical values resulting in Invalid Argument .

2021-05-11 09:00:59 [-][1][b2d853dc9ea35b184b8cb6d664a739d6][error][yii\base\InvalidArgumentException] yii\base\InvalidArgumentException: 'hello' is not a numeric value. in /app/vendor/yiisoft/yii2/i18n/Formatter.php:1745
Stack trace:
#0 /app/vendor/yiisoft/yii2/i18n/Formatter.php(1137): yii\i18n\Formatter->normalizeNumericValue('hello')
#1 /app/plugins/cms/src/fields/Number.php(251): yii\i18n\Formatter->asDecimal('hello', 0)
#2 /app/plugins/cms/src/base/Field.php(360): craft\fields\Number->inputHtml('hello', Object(craft\elements\Entry))
#3 /app/plugins/cms/src/fieldlayoutelements/CustomField.php(248): craft\base\Field->getInputHtml('hello', Object(craft\elements\Entry))
#4 /app/plugins/cms/src/fieldlayoutelements/BaseField.php(203): craft\fieldlayoutelements\CustomField->inputHtml(Object(craft\elements\Entry), false)
#5 /app/plugins/cms/src/fieldlayoutelements/CustomField.php(216): craft\fieldlayoutelements\BaseField->formHtml(Object(craft\elements\Entry), false)
#6 /app/plugins/cms/src/models/FieldLayout.php(532): craft\fieldlayoutelements\CustomField->formHtml(Object(craft\elements\Entry), false)
#7 /app/vendor/twig/twig/src/Extension/CoreExtension.php(1507): craft\models\FieldLayout->createForm(Object(craft\elements\Entry), false)
#8 /app/plugins/cms/src/helpers/Template.php(106): twig_get_attribute(Object(craft\web\twig\Environment), Object(Twig\Source), Object(craft\models\FieldLayout), 'createForm', Array, 'method', false, false)
#9 /app/storage/runtime/compiled_templates/7a/7a843888f680c32888c4c7071220e10969519e991f38aeada37012ebed0d4c95.php(160): craft\helpers\Template::attribute(Object(craft\web\twig\Environment), Object(Twig\Source), Object(craft\models\FieldLayout), 'createForm', Array, 'method')
#10 /app/vendor/twig/twig/src/Template.php(405): __TwigTemplate_9330e92c5b80e32fda36e2b0fb2880dda7c56ecf2c599d47995bf0458cd27282->doDisplay(Array, Array)
#11 /app/vendor/twig/twig/src/Template.php(378): Twig\Template->displayWithErrorHandling(Array, Array)
#12 /app/storage/runtime/compiled_templates/d9/d9c2e43d42c3ef79f1f3ceca60bd6f585374292dc8b680c92272ae7658b12717.php(124): Twig\Template->display(Array, Array)
#13 /app/vendor/twig/twig/src/Template.php(405): __TwigTemplate_c30dbb0cc4713317cdf04f031cce4c14444dadb9fd35146afc1e65812f7fdf91->doDisplay('[<span class="s...', Array)
#14 /app/vendor/twig/twig/src/Template.php(378): Twig\Template->displayWithErrorHandling(Array, Array)
#15 /app/vendor/twig/twig/src/Template.php(390): Twig\Template->display(Array)
#16 /app/vendor/twig/twig/src/TemplateWrapper.php(45): Twig\Template->render(Array, Array)
#17 /app/vendor/twig/twig/src/Environment.php(318): Twig\TemplateWrapper->render(Array)
#18 /app/plugins/cms/src/web/View.php(389): Twig\Environment->render('entries/_edit', Array)
#19 /app/plugins/cms/src/web/View.php(450): craft\web\View->renderTemplate('entries/_edit', '[<span class="s...')
#20 /app/plugins/cms/src/web/Controller.php(257): craft\web\View->renderPageTemplate('entries/_edit', '[<span class="s...', '<span class="st...')
#21 /app/plugins/cms/src/controllers/EntriesController.php(250): craft\web\Controller->renderTemplate('entries/_edit', Array)
#22 [internal function]: craft\controllers\EntriesController->actionEditEntry(Object(craft\models\Section), 15, NULL, NULL, Object(craft\models\Site), Object(craft\elements\Entry))
#23 /app/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)
#24 /app/vendor/yiisoft/yii2/base/Controller.php(181): yii\base\InlineAction->runWithParams(Array)
#25 /app/plugins/cms/src/web/Controller.php(190): yii\base\Controller->runAction('edit-entry', Array)
#26 /app/vendor/yiisoft/yii2/base/Module.php(534): craft\web\Controller->runAction('edit-entry', Array)
#27 /app/plugins/cms/src/web/Application.php(279): yii\base\Module->runAction('entries/edit-en...', Array)
#28 /app/vendor/yiisoft/yii2/web/Application.php(104): craft\web\Application->runAction('entries/edit-en...', Array)
#29 /app/plugins/cms/src/web/Application.php(264): yii\web\Application->handleRequest(Object(craft\web\Request))
#30 /app/vendor/yiisoft/yii2/base/Application.php(392): craft\web\Application->handleRequest(Object(craft\web\Request))
#31 /app/web/index.php(20): yii\base\Application->run()
#32 {main}

Steps to reproduce

  1. Create a Number field
  2. Attach to an entry type
  3. Go to entry form
  4. Enter text in the Number field and save

Additional info

  • Craft version: 3.6.14
  • PHP version: 7.4
@brandonkelly
Copy link
Member

Fixed in 3.6.14.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants