Category archive

web development

General Posting

82 articles

CMS

How to search in specific content type in drupal 7

Suppose you have created a content type named as “testimonial”. Now the requirement is to for search for a value “hello” under field name “title” then you can do so by using the below query. Please make sure that you have the “Entity API” module enabled. $searchkeyword = $_REQUEST[‘keyword’]; $query = new EntityField

Aug 1, 2018

Read article

General

validate email id using jquery or javascript

function validateEmail(email) { var emailReg = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,6})?$/; return emailReg.test(email); } Usage:- if(validateEmail(emailString)){ alert(‘Your email is valid’); } else{ alert(‘Your email is not valid! There should be atleast @ and one dot(.) present in it’); }

May 4, 2018

Read article

HTML

Validate date format mm/dd/yyyy in jquery or javascript

<script type=”text/javascript”> function isValideDate(datavalue){ var regexValidDate = /^(?:(0[1-9]|1[012])[\/.](0[1-9]|[12][0-9]|3[01])[\/.](19|20)[0-9]{2})$/; return regexValidDate.test(datavalue); } var dateToCheck = ’06/01/2011′, if(isValideDate(dateToCheck)){ alert(“Given date is valid as per the format of MM/dd/Y

Mar 8, 2018

Read article

HTML

Redirect to another page after a specific time interval

<html> <body> <h1>Welcome to my Website</h1> <h4 id=”msg”>You will be redirected to another page in 5 seconds!</h4> <script type=”text/javascript”> function countDown(i, callback) { callback = callback || function(){}; var int = setInterval(function() { //document.getElementById(“displayDiv”).innerHTML = “Number: ” + i

Jan 23, 2018

Read article

CMS

How to wrap data column in Gridview widget in yii or yii2 framework

The column which you want to wrap should be added the property called “contentOptions” where you can apply the css property to suits your needs and requirements as below. [ ‘attribute’ => ‘column name’, ‘format’ => ‘html’, ‘noWrap’ => false, ‘mergeHeader’=>true, ‘contentOptions’ => [‘style’ => ‘width: 50%; overflow: sc

Nov 20, 2017

Read article

MVC

How to get raw sql query in yii or yii2 framework

If you have used the query builder in yii 2.0.8 framework then to get the raw sql generated use the below statement. $query->andFilterWhere([‘like’, ‘username’, $this->username]) ->andFilterWhere([‘like’, ’email_id’, $this->email]) ->andFilterWhere([‘registration_date’ => $this->register_date]); // This is echo the raw

Nov 15, 2017

Read article