Set default value for datepicker using jQuery in Drupal

Datepicker in drupal is rendered as separate select elements for day, month and year by default which makes it difficult to set a default value if we want to set it to some string value, eg. today, +2 months, etc. This page is to check how we can set default value for datepicker using a simple jQuery.

Get string from PHP

Consider you have the above string value. If you are sending this value from a php code, convert it to a date format using strtotime().

Hidden Element not submitted on Drupal Form

Hidden elements can be easily created on a Drupal form. When the form is submitted, $form_state variable seems to be holding the value of this element in various hooks, "form_alter", "validate", etc.

Note that if you have an ajax call or a jquery code which assigns or modifies the value of the hidden element, this value will not be sent when the form is submitted. For eg, An hidden element is created from -

Delete git branch from local and remote

Github provides different options to delete unwanted branches on your git terminal or from remote github repository.

Delete a branch from your local git terminal.

Use a simple --delete option to delete a branch from your local git.

git branch --delete <branch_name>

This will not delete a branch if you have a commit or any work in progress. To delete it forcefully, use -D with the branch name.

How to install ImageMagick and Imagick on Ubuntu or Debian.

ImageMagick is a popular tool used for creating and modifying images. Check below to know how ImageMagick and Imagick on Ubuntu is installed and configured.

Install ImageMagick

Use a simple apt-get to install this as it is already included in the base repository.

sudo apt-get install imagemagick

Install Imagick

Use apt-get to install imagick -

Create free website using Github

GitHub provides a very good platform to keep our repositories, modify and control them in an organised way. It also enables us to create free website of our own with a domain ".github.io".

All you need is an HTML template which can be downloaded for free based on your requirement(blog, wedding website, etc) or a code which is capable of displaying a webpage.