A select with number at start of value throws an error
See original GitHub issueBug report
Describe the bug
If you create a list with numbers at the start of the value of will throw an error on start.
message: 'Syntax Error: Expected Name, found Int "0"',
To Reproduce
- Create a list like:
keystone.createList('ExampleList', {
fields: {
age: {
type: Select,
options: '0-18,19-35,36-50,50+',
},
},
});
- Start Keystone.
It doesn’t seem to matter if you use the array notation either:
keystone.createList('ExampleList', {
fields: {
age: {
type: Select,
options: [
{ label: '0-18', value: '0-18' },
{ label: '19-35', value: '19-35' },
{ label: '36-50', value: '36-50' },
{ label: '50+', value: '50+' },
],
},
},
});
Expected behaviour
I can’t see a clear reason why this cannot work. There are no limitations on storing this in a text field in the DB or on the possible values in HTML.
System information
I was using Knex Adapter
Additional context
Is Monday.
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (6 by maintainers)
Top Results From Across the Web
Oracle - Select statement throwing an error - Stack Overflow
is there any way I can do a cast to that column and get just the numbers in it. I need only numbers...
Read more >How to correct a #VALUE! error - Microsoft Support
Type a 4 in cell B1. Then in C1 type this formula =B1-A1. If you get the #VALUE! error, go to the next...
Read more >Db2 11 - SQL error codes - IBM
AN UNSUPPORTED SQLTYPE WAS ENCOUNTERED IN POSITION position-number OF THE SELECT-LIST; Start of change -352 End of change
Read more >Less than (<) - JavaScript - MDN Web Docs
BigInt and number values can be compared together. ... be converted to a BigInt value (it throws a syntax error when passed to...
Read more >2 Server Error Message Reference - MySQL :: Developer Zone
Check the %d value to see what the OS error means. For example, 28 indicates that you have run out of disk space....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Solution options:
enum
and generate better error messages and provide more explicit docs.enum
to support a broader range of options. This would require a major breaking change and would require a significant change to how we handle this field type. I’m not sure there are any good reasons to do this, but it’s something we should discuss.Implementing the docs and error messages in option 1) is something we can and should do before we make a final decision on option 2).
I really think the solution is to fix this even if it’s a breaking change. It makes no senses to limit the types of data that people can put in the value of a select. I need to understand more about how this is a breaking change.