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. Image for the cookie policy date
close icon

how to stop validation on grid cancel button


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 


3 Replies

IR Isuriya Rajan Syncfusion Team 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.


BB Bharat Buddhadev 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.


IR Isuriya Rajan Syncfusion Team 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


Loader.
Live Chat Icon For mobile
Up arrow icon