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.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

how to stop validation on grid cancel button

Thread ID:

Created:

Updated:

Platform:

Replies:

120807 Oct 16,2015 06:56 AM UTC Oct 21,2015 02:21 PM UTC JavaScript 3
loading
Tags: ejGrid
Bharat Buddhadev
Asked On October 16, 2015 06:56 AM UTC


Waiting urgently for you quick reply.
How to stop validation on click on Grid Cancel button 


 <div class="securityAccessGrid" ma-security-grid-sorting ma-grid-button-disable>
                    <div ng-init="getListofAccessGroup()" id="securityGrid" e-scrollsettings-width="null"
                         ej-grid e-datasource="data"
                         e-columns="columns" class="gridStyle"
                         e-allowresizing="true" e-allowkeyboardnavigation="true" e-allowscrolling="true" e-allowsorting="true" e-toolbarsettings-showtoolbar="true" e-toolbarsettings-toolbaritems="tools" e-editsettings-allowediting="true" e-editsettings-allowadding="true" e-editsettings-allowdeleting="true" e-minwidth="550" e-isresponsive="true" e-scrollsettings-height="{{maximumGridHeight}}" e-actioncomplete="actioncomplete" e-rowselected="rowselected"
                         e-actionbegin="deleteConfirmation" e-beginedit="beginEdit"></div>
                </div>

   $scope.columns = [
            { field: "markingId", isPrimaryKey: true, visible: false },
            { field: "markingString", headerText: administrationSecurityResources.securityGroupName, validationRules: { securityMarking: [], required: true } }
        ];


    $.validator.addMethod("securityMarking", function (value, element, params) {
            securityAccessGroup = value;
            var errrorMessage;
            if (value.charAt(0) === whiteSpace || value.charAt(0) == "-" || value.charAt(0) == "_" || value.charAt(0) == "," || value.charAt(0) == ";" || value.charAt(0)==":") {
                setFocus(element);
                errrorMessage = administrationSecurityResources.whiteSpaceError;
                setErrorForSecurity(errrorMessage);
                $rootScope.$broadcast("setSaveDisable", "securityGrid");
                return false;
            }
            if (element.value.trim().length > maxAcceGroupCharacter) {
                setFocus(element);
                errrorMessage = administrationSecurityResources.accessGroupMaxLength;
                setErrorForSecurity(errrorMessage);
                $rootScope.$broadcast("setSaveDisable", "securityGrid");
                return false;
            }
            if (!checkUniqness()) {
                setFocus(element);
                $rootScope.$broadcast("setSaveDisable", "securityGrid");
                return false;
            }
            $rootScope.$broadcast("setSaveEnable", "securityGrid");
            return true;
        }, errorMessage);



When I click on cancel button validation Fires 
How to stop validation on click on cancel button 


Isuriya Rajan [Syncfusion]
Replied On October 19, 2015 05:31 PM UTC

Hi Bharath,
Thanks for contacting Syucfusion support.
We have tested this issue in our sample and able to reproduce the issue while clicking cancel button. The validation message was shown for a second and get disappear.
Please refer to the attached video,
Video Link: Video
Could you please confirm, is the same issue you have faced? And also can you please share the browser and Essential studio version details.
Regards,
Isuriya R.

Bharat Buddhadev
Replied On October 20, 2015 09:58 AM UTC

Thanks for video
Yes , I am facing the same Issue Which you have mention in video
Can you suggest me the solution.

Isuriya Rajan [Syncfusion]
Replied On October 21, 2015 02:21 PM UTC

Hi Bharath,
Your requirement is achieved by setting false to the $.validator.defaults.onfocusout. We have created a sample for this. By default jQuery customvalidation will trigger at the time of element focusout .To prevent the default element focusout, we need to set it as false in the initial state.
 Refer to the sample and code example below:
Sample: Sample

 

<script>

       $.validator.defaults.onfocusout = false;  

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

              if(element.value.length == params)

                   return true;

          return false;

        }, 'Cancel button trigger valiadation');

             

        

        angular.module('listCtrl', ['ejangular'])

        .controller('PhoneListCtrl', function ($scope) {

                        .. . . . .

              });

             


    </script>


Regards,
Isuriya R


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.

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

;