Event if the minimum or maximum values were exceeded

I would like to display a popup window ​​with the minumum and maximum values if the user tries to enter values ​​outside thelimits.
An event would be good for this that is raised if the minimum or maximum values ​​were exceeded.


5 Replies 1 reply marked as answer

SS Sridevi Sivakumar Syncfusion Team July 21, 2020 11:15 AM UTC

Hi Werner Schattmann, 
 
Greetings from Syncfusion.
 
  
We would like to let you know that, your requirement “To notify the popup with its valid Min and Max on its updated value beyond that limit” has been achieved by using ValueChanged  event  with OnKeyFocus of ValueChangeMode as per in below-provided demo sample,

Sample linkhttps://www.syncfusion.com/downloads/support/directtrac/general/ze/NumericBoxSample355678755   

To know more about this,
 

Regards,
Sridevi S. 



WS Werner Schattmann July 21, 2020 01:22 PM UTC

Your example works only  with ValueChangeMode="OnKeyFocus".
There is a big problem with Your example when the minimum value is above zero. E.g. 500
In this case the following happens:
The user wants to delete all digits of the old value (e.g. 700) with backspaces: For each backspace the alert window is shown.
After this he wants to type in e.g. 600: For the first two digits the alert window is shown because the number is still below the limit.

That behaviour is unusable.

In my opinion a alert window can only work in the OnLostFocus mode. With a additional event sending the value before the value is corrected to the minimum or maximum limit. Other libraries also provide for these the possibility to cancel the new value.

Best regards









SS Sridevi Sivakumar Syncfusion Team July 22, 2020 05:46 PM UTC

Hi Werner Schattmann,

We can understand your use case, and as per our current implementation of SfNumericTextBox, we have set Value property in source level with either Maximum / Minimum when it exceeds their limit. That is our current behavior.


And we have also considered your scenarios and provide a workaround to achieve your requirement with the help of UnFocused event and without setting Minimum and Maximum values (Please keep your min and max value in some internal local property) as mentioned in below code snippet>

Code snippet:
 
  
        <xforms:SfNumericTextBox Minimum="0" Maximum="100" Unfocused="SfNumericTextBox_Unfocused"/> 
 
  
         private void SfNumericTextBox_Unfocused(object sender, FocusEventArgs e) 
    { 
            var minimum = 0; var maximum = 100;
            var value = System.Convert.ToDouble(e.Value);
 
            if (!(value >= minimum && value <= maximum)) 
            { 
                DisplayAlert("Alert", "Enter the value must be  0-100", "OK"); 
                numericTextBox.Value = value <= minimum ? minimum : maximum; 
            }


 
    }


 
 
 
Regards, 
Sridevi S. 
 


Marked as answer

WS Werner Schattmann July 22, 2020 05:48 PM UTC

Thanks. This will work for me.


SS Sridevi Sivakumar Syncfusion Team July 23, 2020 05:10 AM UTC

Hi Werner Schattmann, 
 
Thanks for your update and we are glad to hear that you have achieved your requirement.

Please let us know if you need any further assistance and don’t hesitate to contact us.

Regards,
 
Sridevi S. 


Loader.
Up arrow icon