20 May 2016

Javascript regular expression to accept only numeric of length 4 to 6 characters

Following is the javascript regular expression to accept only numeric of length 4 to 6 characters

20 May 2016

Upgrading Drupal 8.0.3 to 8.1.1

Hello Guys,
Today, I have upgraded Drupal 8.0.3 to 8.1.1 and faced few challenges.
Here I am writing down all the steps and resolutions -
Step 1 - Keep Backup of Files and Database

sudo cp -Rf net-texts-8/* net-texts-8-bkp/

28 Apr 2016

Drupal - Colorbox should not be closed on clicking outside

Colorbox should not be closed on clicking outside We can achieve this by using colorbox_settings_alter. Below is the code snippet.

23 Apr 2016

Important Bookmarks

An online tool to display formatted source code


23 Apr 2016

get requested url in jQuery Ajax

Under the jQuery Ajax, newurl = this.url did the trick.
23 Apr 2016

Check-Uncheck all checkboxes using jQuery

1. Uncheck all checkboxes inside a div having class "sub-wrap" using jQuery

jQuery('.sub-wrap input:checkbox').prop("checked", false);

2. Check all checkboxes having class "chk-grade"  using Jquery

 jQuery('input:checkbox.chk-grade').prop("checked", true);

23 Apr 2016

Remove selected options using jQuery

We can remove selected options of a select field using jQuery -

jQuery("#selectbox option:selected").removeAttr("selected");

23 Apr 2016

Truncate the string in Twig

The following code snippet truncate the string into 25 charaters. If the string is more than 25 characters long, then it will append ... (3 dots) at the end.

{{ item.title|length > 25 ? item.title|slice(0, 25) ~ '...' : item.title  }}

23 Apr 2016

cache_get and cache_set in Drupal 8

Cache Get

 $cache_data_subjects = \Drupal::cache()->get('subsubjects_data'); //subsubjects_data is a cache variable name
 $all_subjects = $cache_data_subjects->data;       

Cache Set

25 Mar 2016

News choupai 25 Aug 2016

1. Modi reh gaye peeche, kejriwal NE baazi Mari hai,
Fortune ke list mein abki,mufflerman ki Bari hai.

2 Up ke mantri vidhayko ko study tour per jani hai
Jaate jaate, janta ka paisa loot khani hai.

3 Gujarat se aa rehi kisano ki dard bhari kahani hai,
Kheti kare tamataron ka, bhaw naa mil pani hai,
Majburi aisi ki, janwaron ko pade khilani hai.