question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Carbon : Select component selected value is string though we have integer in option values.

See original GitHub issue

Scope: <DESCRIBE SCOPE OF THIS ISSUE, i.e.: PF4 mapper, Form renderer>

Description

In schema, we have number as value in options, once, we selected options, it is giving out selected value as string.

Screen Shot 2021-03-09 at 3 43 45 PM

Expectation

If we give integer as value in options, selected item should be type integer.

Schema

   {
     "component": "select",
     "label": "Select",
     "name": "select",
     "initialValue":2,
     "options": [
       {
         "label": "Dogs",
         "value": 1
       },
       {
         "label": "Cats",
         "value": 2
       },
       {
         "label": "Hamsters",
         "value": 3
       }
     ]
   }
 ];
 

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:13 (13 by maintainers)

github_iconTop GitHub Comments

2reactions
rvsiacommented, Mar 11, 2021

@kavyanekkalapu I found what the issue and made a PR to fix. We will also backport this fix to v2.

2reactions
rvsiacommented, Mar 10, 2021

@kavyanekkalapu thanks for reporting this! Actually the issue is in the number 0, if you change 0 to some other value, it works well. It will be probably some edge-case bug, I will investigate tomorrow.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to get selected value of a dropdown menu in ReactJS
Hi, if you need to specify a default value you can use defaultValue="10" and this will select your option. I hope it helps....
Read more >
Select – Carbon Design System
The select component allows users to choose one option from a list. It is used in forms for users to submit data.
Read more >
Select: value is always of type string · Issue #11155
Seems like I went looking into "option" with anticipation to find some input source data. Select also accepts only string as value and ......
Read more >
24 Working with dates and times
Stata stores dates, times, and dates and times as integers such as −4,102, 0, 82, 4,227, and. 1,479,735,745,213. It works like this: 1....
Read more >
JSON functions | BigQuery
Returns a SQL NULL if a non-scalar value is selected. STRING. JSON_QUERY_ARRAY, Extracts an array of JSON values, such as arrays or objects,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found