We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Custom Validation Method Async

Thread ID:

Created:

Updated:

Platform:

Replies:

145765 Jul 4,2019 11:11 AM UTC Jul 12,2019 10:36 AM UTC ASP.NET MVC 5
loading
Tags: Grid
Erik
Asked On July 4, 2019 11:11 AM UTC

Hi,

I need an example on how to use an ajax async request inside an "addMethod" call from the grid component.

$.validator.addMethod("myFunction", function (value, element, params) {

            $.ajax({
                type: "GET",
                url: 'MyFunction',
                ...
                },
                success: function (data) {
                   return 
                }
            });
        }, "Error"); 
    });

With this code, the validator returns false before the ajax request completes. I did it this way instead of using the "remote" ValidationRule because I need to pass two parameters to the function on the server. If there is a better solution to this, please let me know.


Thank you.

Thavasianand Sankaranarayanan [Syncfusion]
Replied On July 5, 2019 09:27 AM UTC

Hi Erik, 

Greetings from Syncfusion support. 

Before proceeding to your query please provide whether you have using EJ 1 Grid component or EJ 2 Grid component in your application. Based on your confirmation we can provide better assistance on your requirement. 

Regards, 
Thavasianand S. 


Erik
Replied On July 5, 2019 11:01 AM UTC

Hi Thavasianand,

I'm using the EJ 1 Grid component.


Regards,

Farveen Sulthana Thameeztheen Basha [Syncfusion]
Replied On July 8, 2019 09:39 AM UTC

Hi Erik 

Thanks for contacting Syncfusion Support. 

Query:-  I did it this way instead of using the "remote" ValidationRule because I need to pass two parameters to the function on the server. If there is a better solution to this, please let me know. 
 
We have checked your query and we have already discussed in our syncfusion knowledge base  about how to perform serverside validation on server side. From this you can pass the required values to serverend through ajax post and perform validation on it.  
 
For your convenience, refer to the KB link:- 

Please get back to us if you need any further assistance. 

Regards, 
Farveen sulthana T 


Erik
Replied On July 11, 2019 04:31 PM UTC

Hello Farveen.

Thank you very much. That worked perfectly.


Regards.


Farveen Sulthana Thameeztheen Basha [Syncfusion]
Replied On July 12, 2019 10:36 AM UTC

  
Hi Erik, 

Thanks for your update. Please get back to us if you need any further assistance. 

Regards, 

Farveen sulthana T 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon