Integer model for In-place Editor posting decimal values

Hello,

I'm trying to only allow integer values in an in-place editor, by providing an integer model. The control seems to truncate a decimal value entered, so it's displayed as an integer in the UI, but still posts the decimal value provided. Is there any way to use the in-place editor to ensure a decimal value is never passed along to the server? I see in the documentation that the validationRules are not able to check for integer vs decimal values, correct?

Here's a redacted version of the code:

@{

var intModel = new { format = "n0" };

}

<ejs-inplaceeditor

                model="@intModel">

 </ejs-inplaceeditor>

Thanks very much


3 Replies

VJ Vinitha Jeyakumar Syncfusion Team June 27, 2022 10:57 AM UTC

Hi Andrew,


We have tried to reproduce the reported issue by setting format to the numeric type In-Place Editor, but we didn't face any issues as you reported. The integer value is maintained in the element. please check the sample below,


Can you please share the below details,

  • your package version.
  • Exact issue reproducing steps.
  • If possible please share us with the issue reproducing runnable sample.

Regards,
Vinitha


AL Andrew Lloyd June 30, 2022 06:17 PM UTC

Hi Vinitha,

Thanks for your response. Unfortunately, my issue is not with the value appearing as an integer in the element in the UI, that is working fine. My issue is with the incorrect decimal value being passed along to the controller. Sorry, I will try to explain more clearly here.

I've defined my model as an integer in my inplace editor:

modelInt.png

And in the UI, when a decimal value is entered (here I've entered '1.4'), the value is truncated, in the UI at least:

intInUI.png

But as you can see in this break point in my controller, the original decimal value has been passed along, 1.4:

decimalInController.png

Is this the expected behaviour, or is this a bug?

Thanks very much!



VJ Vinitha Jeyakumar Syncfusion Team July 1, 2022 01:28 PM UTC

Hi Andrew,

We again tried to replicate the reported issue from our end. but couldn't replicate the same. so can you please share the issue replicating entire code snippet or runnable sample to further validate on the issue.

Regards,
Vinitha


Loader.
Up arrow icon