Monday 2 April 2018

how to validate date textbox using jquery format as dd MMM yy?

// condition null check
if (rowdata.EffectiveDate != null) {
           // validate format
            var date_regex = /^(([0-9])|([0-2][0-9])|([3][0-1]))\ (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec|jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)\ \d{2}$/;
            // if different format tha dd MMM yy it will return false
            if (!(date_regex.test(rowdata.EffectiveDate))) {
           
                alert('Please enter valid date!.');
                return;
            }
        }

Wednesday 21 February 2018

Disable cut copy paste options in textbox using angularjs

in Angularjs has predefined ng attribute, by using this we can achieve disabling Cut Copy Paste options in Textbox or text area.


<input type="text" class="form-control" ng-cut="$event.preventDefault()" ng-copy="$event.preventDefault()" ng-paste="$event.preventDefault()" ng-model="modelvalues" />