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

Remote validation Not working as excepted

1 Answer 39 Views
This is a migrated thread and some comments may be shown as answers.
Shahram
Top achievements
Rank 1
Shahram asked on 15 Apr 2020, 07:23 AM

I was searching for Grid remote validation and I reached your demo demo.
I Have two questions .

1-In this demo validator shows the error message but accepts the input.is there any way that we prevent adding record to data base when remote validation result is false?
in your demo I have added many of the same name product and validation does not prevent me doing this.

2-this message is not shown for editing. but I could not find how you handled this is source.

1 Answer, 1 is accepted

Sort by
0
Veselin Tsvetanov
Telerik team
answered on 17 Apr 2020, 06:17 AM

Hi Shahram,

Here are the answers to your questions:

1. What I would suggest you is to extend the remote validation rule, so that when false is returned, you could disable or hide the update button:

success: function (data) {
  if (data == true) {
    input.attr("data-val-remote", "");
     input.closest('tr').find('.k-grid-update').show();
  } else {
    input.attr("data-val-remote", data);
    input.closest('tr').find('.k-grid-update').hide();
  }
...

2. I am not quite sure about your second question. While editing an existing record in the Grid, in case an already existing name has been typed, the validation is still preset. You could see the image attached, demonstrating such a scenario.

Regards,
Veselin Tsvetanov
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
Tags
Grid
Asked by
Shahram
Top achievements
Rank 1
Answers by
Veselin Tsvetanov
Telerik team
Share this question
or