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

Add support for int for the <InputSelect> component #18305

Closed
giorgi-abashidze opened this issue Jan 12, 2020 · 6 comments
Closed

Add support for int for the <InputSelect> component #18305

giorgi-abashidze opened this issue Jan 12, 2020 · 6 comments
Labels
area-blazor Includes: Blazor, Razor Components enhancement This issue represents an ask for new feature or an enhancement to an existing one
Milestone

Comments

@giorgi-abashidze
Copy link

giorgi-abashidze commented Jan 12, 2020

.NET Standard 2.1 webassembly app, i have problem validating int field, in more details i have list of items in inputselect and their Ids into <option value="@item.Id">

i have [Required] Data anotation in this field in model class but still not care, onvalidsubmit method is calling even if <optionvalue=""> is selected,

i tried to add another data anotation to the field greater than zero [Range(0, Int32.MaxValue, ErrorMessage = "Parent id is Required")]

and replaced default select option -> <option value="" selected> with <option value="0" selected>

still not works.

update:

validation is working fine. problem is binding. @bind-Value not changing the fields value, I added default value 0 to the field and it showing error now, but when select other item, field value not updating and showing the same error.

@mkArtakMSFT mkArtakMSFT added area-blazor Includes: Blazor, Razor Components feature-blazor-wasm This issue is related to and / or impacts Blazor WebAssembly labels Jan 12, 2020
@giorgi-abashidze giorgi-abashidze changed the title Inputselect validation not working with field type of int Inputselect @bind-Value not updating value for field type of int Jan 12, 2020
@javiercn
Copy link
Member

@giorgi-abashidze thanks for contacting us.

In order for us to be able to investigate this issue. Could you provide a minimal repro project that shows the problem and detailed steps on how to reproduce it?

@javiercn javiercn added the Needs: Author Feedback The author of this issue needs to respond in order for us to continue investigating this issue. label Jan 13, 2020
@giorgi-abashidze
Copy link
Author

giorgi-abashidze commented Jan 13, 2020

@javiercn here is the demo project

https://github.com/giorgi-abashidze/InputSelect-Test-For-int

The field name for test is BrandId

created new test project and now i'm getting error in console: inputselect not suporting type Int32.
in old project there was no errors in console maybe because i had form in modal.

@ghost ghost added Needs: Attention 👋 This issue needs the attention of a contributor, typically because the OP has provided an update. and removed Needs: Author Feedback The author of this issue needs to respond in order for us to continue investigating this issue. labels Jan 13, 2020
@mkArtakMSFT mkArtakMSFT added this to the next sprint planning milestone Jan 13, 2020
@mkArtakMSFT mkArtakMSFT added enhancement This issue represents an ask for new feature or an enhancement to an existing one and removed Needs: Attention 👋 This issue needs the attention of a contributor, typically because the OP has provided an update. labels Jan 13, 2020
@mkArtakMSFT mkArtakMSFT added enhancement This issue represents an ask for new feature or an enhancement to an existing one and removed feature-blazor-wasm This issue is related to and / or impacts Blazor WebAssembly enhancement This issue represents an ask for new feature or an enhancement to an existing one labels Jan 23, 2020
@mkArtakMSFT mkArtakMSFT mentioned this issue Jan 30, 2020
@mkArtakMSFT mkArtakMSFT changed the title Inputselect @bind-Value not updating value for field type of int Add support for int for the <InputSelect> component Apr 28, 2020
@RogerMKE
Copy link

RogerMKE commented May 1, 2020

Just to be clear, to handle real world scenarios, the InputSelect needs to handle both int and Guid, as well as the nullable versions of each. Not just 'int'.

Options values sourced from a database are almost always going to have int or Guid keys. The input model being bound to may or may not require the user to make a choice from the list, so the nullable variants are appropriate for that situation.

In its current state, InputSelect out of the box is unusable in many real world scenarios, where int and Guid dominate.

@mrlife
Copy link
Contributor

mrlife commented Jul 22, 2020

Supporting int is a basic need for this type of component. This workaround in the meantime was provided by @SteveSandersonMS.

#11181 (comment)

@MackinnonBuck
Copy link
Member

Closing as this was fixed as part of #23415.

@mrlife
Copy link
Contributor

mrlife commented Jul 24, 2020

@MackinnonBuck Is this a 5.0 only release?

@ghost ghost locked as resolved and limited conversation to collaborators Aug 23, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-blazor Includes: Blazor, Razor Components enhancement This issue represents an ask for new feature or an enhancement to an existing one
Projects
None yet
Development

No branches or pull requests

6 participants