Author: Hari Rajagopal

Clear your form using Javascript

If you need to clear all the input fields irrespective of type in a form, try the below code.  The below code works even if your fields contains place holders.

    $.fn.clearForm = function() {
      return this.each(function() {
        $(':input', this).each(function() {
          var type = this.type, tag = this.tagName.toLowerCase();
          if (type == 'text' || type == 'password' || tag == 'textarea')
            this.value = '';
          else if (type == 'checkbox' || type == 'radio')
            this.checked = false;
          else if (tag == 'select')
            this.selectedIndex = -1;
        });
      });
    };

 

 2,976 total views,  1 views today

Install Constant Contact in Laravel

To setup an option for newsletter signup with Constant Contact and Laravel Framework

  1. Install PHP5 Curl using the below command
    sudo apt-get install php5-curl
    
  2. Add the below code in composer.json
    "require": {
               "laravel/framework": "4.2.*",
               "curl/curl": "1.2.*",
               "constantcontact/constantcontact": "1.2.*"
    	},
    
  3. Run the below command to install constant contact in laravel
    composer update
    

     

 9,098 total views,  4 views today