ValidationRules for In-place Editor not recognizing zero as min value

Hello,

I'm trying to set a validation rule in my in-place editor, to flag values below zero. It works fine with any value besides zero, 0.01, or -0.01 etc. But if set to exactly zero, it seems to block the post, but does not trigger the set 'validation' function, or provide any default error message in the UI, if no validation function is provided. 

Here is my validation rule:

validationRules="new { AverageFee = new { min= 0 } }"


Thanks very much.



4 Replies

VJ Vinitha Jeyakumar Syncfusion Team June 27, 2022 02:39 PM UTC

Hi Andrew,


Currently, we are validating your reported query with our internal team. We will update you the further details on or before 29th June 2022.

Meanwhile, you can use the below workaround to resolve the reported issue,

Use nullable int type to the min variable while using in Validation Rules

Code snippet:
Index.cshtml:
<ejs-inplaceeditor id="numeric" type="Numeric" name="numeric" validationRules="ViewBag.validationRules1"  mode="Inline" value=10 >
 </ejs-inplaceeditor>


HomeController.cs
public class ValidationDetails {
        public int? min { get; set; }
 }

public IActionResult Index()
        {            
            ViewBag.validationRules1 = new { numeric = new ValidationDetails  { min = 0 } };
            
            return View();
        }

Regards,
Vinitha


VJ Vinitha Jeyakumar Syncfusion Team July 6, 2022 06:55 AM UTC

Hi Andrew,


We want to let you know that the '0' is considered as the default value while serializing the objects. Hence, we cannot change this serialization objects due to performance issues. 

So can you please use the previously suggested workaround to resolve the reported issue from your end.

Regards,
Vinitha


AL Andrew Lloyd July 6, 2022 03:26 PM UTC

Ok, thanks very much



VJ Vinitha Jeyakumar Syncfusion Team July 7, 2022 04:48 AM UTC

Most welcome, we are glad to assist you.


Loader.
Up arrow icon