Creative, Informative and Entertaining Stuff for everyone

Monday February 6th 2012

Categories

Archives

Calender

February 2012
S M T W T F S
« Dec    
 1234
567891011
12131415161718
19202122232425
26272829  

‘web development’ Archives

update query based on condition

$con = sfContext::getInstance()->getDatabaseConnection('propel'); $c2 = new Criteria(); $c2->add(TblTopPeer::TF_ZIPCODE,$topForecastInfo->getForZipcode()); $c2->add(TblTopPeer::TF_FORCASTDATE,$topForecastInfo->getForForecastdate()); $c3 = new [...]

How to apply or condition for mysql query in symfony

$cs = new Criteria(); $criterion = $cs->getNewCriterion(HfArticlesPeer::AR_DESCRIPTION,'%'.$searchText.'%',Criteria::LIKE); $criterion->addOr($cs->getNewCriterion(HfArticlesPeer::AR_TITLE,'%'.$searchText.'%',Criteria::LIKE)); $criterion1 = [...]

No connection params set for propel

When you are using symfony framework , and when you get the error as "No connection params set for propel" ,Do the following changes . In config /databases.yml file Replace all: propel: class: sfPropelDatabase param: datasource: symfony dsn: mysql://root:@localhost/mywebsite with all: propel: class: sfPropelDatabase param: phptype: [...]

how to create html element dynamically in javascript

var itemManCnt=2; function addMoreHomeImage() { if(itemManCnt==6) { alert("You can upload only 5 files"); return false; } var parentObj=document.getElementById('FileElementItem'); var divClrBoth = document.createElement("div"); divClrBoth.setAttribute("class","ClrBoth"); divClrBoth.setAttribute("id",itemManCnt); var divClrSelect = [...]

file type validation in javascript

function isValidfile(filename) { file_value = filename; var checkfile = file_value.toLowerCase(); if (!checkfile.match(/(\.doc|\.DOC|\.pdf|\.PDF)$/)) { return false; } else { return true; } }

image validation in javascript

function isValidImage(imagename) { imagefile_value = imagename; var checkimg = imagefile_value.toLowerCase(); if (!checkimg.match(/(\.jpg|\.gif|\.png|\.JPG|\.GIF|\.PNG|\.jpeg|\.JPEG)$/)) { return false; } else { return true; } }

To check whether given date is less than current date

function IslessThanCurrentYear(year) { var d = new Date(); currentyear = d.getFullYear(); if (year>currentyear) { return false; } else { return true; } }

To check leap year

function IsLeapYear(year) { if ((year%4)==0) { if ((year%100==0) && (year%400)!=0) { return false; } else { return true; } } else { return false; } }

URL validation

function checkURL(url) { var theurl=url; var tomatch= /^(http?:\/\/|ftp:\/\/)(www\.)?+\.(com|org|net|mil|edu|ca|co.uk|co.in|com.au|ac.in|gov|gov.in)(\/)?/; if (tomatch.test(theurl)) { return true; } else { return false; } }

validate email address

function echeck(str) { var at="@" var dot="." var lat=str.indexOf(at) var lstr=str.length var ldot=str.indexOf(dot) if (str.indexOf(at)==-1){ return false } if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){ return false } if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){ return false } if [...]

 Page 2 of 3 « 1  2  3 »