-
-
Notifications
You must be signed in to change notification settings - Fork 533
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
Blazorise TextEdit RegEx issue #4972
Comments
We will look into it. In the mean time, can you try to use NumericPicker instead of NumericEdit? It should have more control over value editing. |
I have tested and I cannot reproduce it on my machine. Can you provide us with more information?
|
Blazorise Version: 1.2.4 In our instance if you type the decimal into the empty field it looks as though it is trying to add it as the text cursor flashes, but no decimal shows up. I tested in edge as well and the same behaviour persists there. And this is our on text changed method for the field which has been the same since August 2022 when it was implemented and working:
|
This is an automated message reminding that this issue is expecting the author's answer. |
My suspect is that the locale might be what is causing it. I will need to recheck. |
I'm still unable to reproduce it. I have tried with several different cultures and locales. |
Hello @lachlanlhhq, thank you for your submission. The issue was labeled "Status: Repro Missing", as you have not provided a way to reproduce the issue quickly. Most problems already solve themselves when isolated, but we would like you to provide us with a reproducible code to make it easier to investigate a possible bug. |
It seems like the main culprit might be the TextChanged property. I created a new simple solution and added our code to the Index.razor and the issue is occurring. Below is each page and the code that was added there to test. My guess would be the TextChanged has been updated since we first implemented it and that caused the previously working code to no longer work. Edit: Apologies for the formatting, can't seem to add the razor field code in without it hiding so I have included screenshots instead. |
There is your problem. You're converting the raw Text string value to a number, and it will lose all the details of a string once it is converted. Like the position of a decimal place, padding, and trailing zeros, etc. You must always work with a value that you're binding. In this case, you should bind to a string directly. And then, if needed, you can convert it to a decimal without affecting the original. <TextEdit @bind-Text="YourFieldName" />
@code {
string YourFieldName { get; set; }
// add error handling
decimal? YourAmount => Convert.ToDecimal(YourFieldName);
} |
This is an automated message reminding that this issue is expecting the author's answer. |
RegEx that used to work is no longer working the same way as it previously did.
Steps to reproduce the behaviour:
The behaviour expected of the field is to allow decimals to 2 places. This code used to work but it was only noticed recently that it no longer functions anymore. We are using the numeric edit in the mean time with a decimal t value, but this does not allow us to put negative values in easily (you must type a number then add the negative after). We were using the text edit as a way around this and to be able to control the mask type and regex manually, but something has changed.
Example field:
Please find below the link to the original bug raised on the abp support forum
https://support.abp.io/QA/Questions/5616/Blazorize-Text-Edit-Control-with-Regex-not-working
Any info on what has caused the issue and how to rectify would be greatly appreciated.
Thanks
The text was updated successfully, but these errors were encountered: