Skip to main content

Posts

Showing posts from July, 2020

jQuery Datatable add date range filter

jQuery Datatable add date range filter Datatable is most useful jQuery plugin that helps to make our html tables more powerful and give powers to user to filter , search, sort, pagination etc, But Data table provides a common filter only and yes we can customize and add filter for each column, but still sometimes we need an advance filter like show results only between a date range, So today we will learn how to create a minimum and maximum date range fields and show date picker on it, and user can fill dates by selecting dates and data table will auto filter records based on it. Keep follow below steps :- I am using Bootstrap if you want to use any other framework then you can use. Create a new index.php file  and paste below code in it, i have used all required CDN like bootstrap, datatable, datepicker etc. <!DOCTYPE html> <html> <head>     <title>Datatable Date Range Filter Example</title>     <link rel="stylesheet" ...

Cakephp rewrite .htaccess rule to allow access of a main root folder

Cakephp rewrite .htaccess rule to allow access of a main root folder This solution will work with any framework so you can use it in any php frameworks In CakePHP sometime  we want to allow a folder access that exists on the root access but CakePHP do not allow us to any main root file directly so here is the simple solution of this issue Go to your directory that you want to allow public access Now create a new .htaccess file in it. For example my project folder name is cakeapp and "foldername" is our folder name that we want to allow access,  then my new .htaccesss file location will be cakeapp/foldername/.htaccess Now paste below code in it <IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f </IfModule> Thats it , now go to browser and try to access it directly. :) Related Links allow access to a specific folder in root directory .htaccess prevent access of root folder except one.

JS HTML REGEX Phone number validation allow 10 digits only

JS jQuery Phone number validation allow 10 digits only If you want to validate an input field where user can input only 10 digits and allow only numeric values then use below code Solutions:- 1) jQuery Allow number upto 10 digits jQuery("#pval").on("keypress keyup blur",function (e) { var thisvallen = jQuery(this).val();    jQuery(this).val(jQuery(this).val().replace(/[^0-9\.]/g,''));       if ((e.which != 46 || jQuery(this).val().indexOf('.') != -1) && (event.which < 48 || event.which > 57)) {           event.preventDefault();       }         if((thisvallen).length > 10) {             jQuery(this).val((jQuery(this).val()).substr(0,10));             event.preventDefault();         } }); 2) Validate Phone number using JS...