This is a migrated thread and some comments may be shown as answers.

MaskedNumericInput and MaskedCurrencyInput odd negative value behavior?

5 Answers 176 Views
MaskedInput (Numeric, DateTime, Text, Currency)
This is a migrated thread and some comments may be shown as answers.
Rob Ainscough
Top achievements
Rank 1
Rob Ainscough asked on 06 Mar 2017, 01:18 AM

When using either NumericInput (Mask="###0") or CurrencyInput (Mask="#4.2") with IsValidationHintVisible="False" and IsClearButtonVisible="False" and Placeholder=" " ... if I enter a negative value ... i.e. -1  or -10 the negative value can't be edited out by user input, highlight the entire content and Backspace or Delete and the negative symbol either "-" or "( )" remains in the input box.

For an end user this becomes very difficult to work with ... so long as the user doesn't enter negative values, all is good, but as soon as they enter a negative value and the editing it out is difficult to impossible.

Am I missing something, or is there some way to get these controls to work better with negative input that needs to be edited out.

Thanks, Rob.

5 Answers, 1 is accepted

Sort by
0
Dinko | Tech Support Engineer
Telerik team
answered on 08 Mar 2017, 01:42 PM
Hi Rob Ainscough,

Thank you for contacting us and for the provided information.

We weren't able to reproduce this behavior using only the provided information. Basically, when we enter a negative value by pressing the minus Numpad key we were able to set or remove the "-" sign. Can you send us additional information about your mask set up? Have you bound the mask to a property from your view model? It will be great if you can send us isolated project from your application reproducing so we can further test it directly on our side.

In addition, the mask which you have set to the NumericInput is invalid. If you want to place zero at the end of the input, you can escape it using the "\" backslash. In your case, the mask will look like this: Mask="###\0". You can take a look at the Mask Tokens help article in our documentation where the Mask property is further described.

We are looking forward to your reply.

Regards,
Dinko
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Rob Ainscough
Top achievements
Rank 1
answered on 09 Mar 2017, 05:30 AM

Hi Dinko,

Thanks for the response, unfortunately those Mask Tokens you pointed me to do NOT resolve my issue with negative values ... if I enter a negative value in a RadMaskedCurrencyInput I end up with "($, 1.00)" and it's impossible to remove the "(" or ")" ... these are bound to a Double in my MVVM.  The ONLY way to remove the negative values is to have IsClearButtonVisible=True, backspace or delete will not remove the "(" ")".  I typically have the IsClearButtonVisible=False as I don't want to us excessive screen real estate.

Here is my sample xaml

<telerik:RadMaskedCurrencyInput x:Name="RateTextBox" Grid.Column="1" Grid.Row="1" Value="{Binding Path=SizeRentRate, Mode=TwoWay, ValidatesOnExceptions=True, ValidatesOnNotifyDataErrors=True, NotifyOnValidationError=True}" Mask="c4.2" TextMode="MaskedText" IsValidationHintVisible="False" IsClearButtonVisible="False" Placeholder=" " TextMode="PlainText" SelectionOnFocus="SelectAll" SpinMode="PositionAndValue" />

 

Any suggestions?

Cheers, Rob.

0
Dinko | Tech Support Engineer
Telerik team
answered on 13 Mar 2017, 11:13 AM
Hi Rob Ainscough,

Thank you for the additional information. Still, I wasn't able to reproduce it on my side using the latest version of our controls. Can you tell me which version of our controls have you referenced to your project? Also, can you try setting the AllowMinusOnZeroValues and AllowMinusOnNullValue attached properties to True? These properties control whether the minus sign ("-") in front of the zero (0 or 0.0) or null value can be visualized or not. You can read more about these properties and how to set them in the MaskedInputExtensions help article.

For your convenience, I have attached the project which I use to test your scenario. Can you take a look at it and modified if I am missing some additional code.

Regards,
Dinko
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Rob Ainscough
Top achievements
Rank 1
answered on 15 Mar 2017, 09:36 PM

HI Dinko,

We're using version 2017.1.206.1050.  

Using the MaskedInputExtensions and setting AllowMinusOnZeroValues="False" and AllowMinusOnNullValue="False" ... I'm able to prevent input of negative values which prevents the situation from happening.  Fortunately I have no cases where users will need to input negative values ... but the behavior is still not correct when these properties are set to True.

Cheers, Rob.

0
Dinko | Tech Support Engineer
Telerik team
answered on 20 Mar 2017, 02:35 PM
Hello Rob Ainscough,

Without reproducing this behavior on our side we can only guess what could be the reason behind this. Can you try modified the project from my last reply to reproduce it or create an isolated project from your application which reproduces this behavior? This way we can directly investigate it on our side.

Regards,
Dinko
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
MaskedInput (Numeric, DateTime, Text, Currency)
Asked by
Rob Ainscough
Top achievements
Rank 1
Answers by
Dinko | Tech Support Engineer
Telerik team
Rob Ainscough
Top achievements
Rank 1
Share this question
or