Posts

Trigger event on Hiding modal box

Some of the peoples will be using this for Bootstrap3 to hide modal box. Some may be facing issues on using this function, $('#myModal').on('hidden.bs.modal', function () {    alert("hii"); }); So, here is the solution for all who are all facing issues, This function will work in all the browsers where as, the above function will not work in some browsers such as chrome, etc. $('#myModal  button').click(function () {     $('#myModal iframe').removeAttr('src'); });

Breezing forms - Get datas from database

Copy the below code in your breezing forms by selecting your form, Go to Advanced -> More options -> Select "Form scripts" -> After Form or Before form its up to your requirement. // load the standard form creation utilities $this->execPieceByName('ff_InitLib'); //set globals global $record; //query db  $rows = ff_select("select * from `#__users`"); $html = ''; foreach ($rows as $row) $html .= "<div style='display:block'> <input type='text' name='$row->user_id' id= '$row->user_id' value='$row->user_id' />  </div>"; return $html; It will return all the values from the users table.

Input field for search

For hidding while OnFocus Search input field, we can use simple Javascript inside the field, <input type="text" name="s" id="searchinput" value="Search here ..." onblur="if (this.value == '') {this.value = 'Search here ...';}" onfocus="if (this.value == 'Search here ...') {this.value = '';}">

Solution for getting error in less than IE9 does not support querySelectorAll

You have to include the below lines, Quirks mode: this is usually triggered by a missing or broken Doctype. If this is the case, make sure your page starts with the following: <!DOCTYPE html> Compatibility mode (IE7 mode): This may be triggered if you're viewing the page locally (ie running it on your local machine, eg for testing, or on your local network). In this case, you are being hit by an IE config setting that you should disable. Go to the Tools menu, and pick the Comaptibility View Settings option. Untick the compatibility options, and the page should start working. Compat mode may also be triggered (or avoided) by an X-UA-Compatibility meta tag. If you're having trouble with compatibility mode, this is a good way to avoid it: Add the following line to your code: <meta http-equiv="X-UA-Compatible" content="IE=edge">  Src: http://stackoverflow.com/questions/16920365/ie8-does-not-support-queryselectorall

Accurate time using PHP

<?php     function ezDate($d) {         $ts = time() - strtotime(str_replace("-","/",$d));                 if($ts>31536000) $val = round($ts/31536000,0).' year';         else if($ts>2419200) $val = round($ts/2419200,0).' month';         else if($ts>604800) $val = round($ts/604800,0).' week';         else if($ts>86400) $val = round($ts/86400,0).' day';         else if($ts>3600) $val = round($ts/3600,0).' hour';         else if($ts>60) $val = round($ts/60,0).' minute';         else $val = $ts.' second';                 if($val>1) $val .= 's';   ...

Date/Time in PHP

<?PHP      //Current Year     $year = date("Y");      //2013         //Current Month     $month = date("m");    //08         //Current day     $day = date("d");     //12         //Tomorrow's day     $day = date("d")+1;    //13             //TODAY'S DATE          $start =  date("Y-m-d");     //2013-08-12               //1 MONTH FROM TODAY          $end = date("Y-m-d",strtotime("+1 months"));     //2013-09-12          //5 DAYS FROM TODAY         $reminder = date("Y-m-d",strtotime("+5...

Birthdate validation for less than 18 in PHP

Here is the code to validate for birthdate, //Validate for users below 18 only function birthdate($then, $min) {   // $then will first be a string-date   $then = strtotime($then);   //The age to be less than 18   $min = strtotime('+18 years', $then);    if(time() < $min)   {      return false;   }   else {      return true;   } }