Rss Feed
  1. Websites to learn!!

    Tuesday, 30 October 2012

    http://www.javascriptkit.com/
     http://ntt.cc/2008/05/10/over-10-useful-javascript-regular-expression-functions-to-improve-your-web-applications-efficiency.html
    http://htmldog.com - html
    http://freeajaxscripts.net - ajax

    Javascript
    Coundown timer
    http://keith-wood.name/countdown.html

    Jquery code
    http://jsfiddle.net/tqyj4/4/       

  2. Javascript to validate all form fields when onSubmit
     
     function checkrefereremail(){
        //var testresults
        var nam=document.getElementById('name').value;
        var mob=document.getElementById('contactno').value;
        var str=document.getElementById('emailid').value;
        var anum=/(^\d+$)|(^\d+\.\d+$)/             // integer validation
      var flag=1;
        var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i     // email validation
        $('#namemsg').html('');$('#mobmsg').html('');$('#emailmsg').html('');$('#captchamsg').html('');
       if(nam == '')
       {
       document.getElementById("namemsg").innerHTML = "Please input a valid name!";
         
          flag++;
       }
       if (anum.test(mob) == false)
        {
        document.getElementById("mobmsg").innerHTML = "Please input a valid mobile no!";
        flag++;
        }
       if(filter.test(str) == false){
        document.getElementById("emailmsg").innerHTML = "Please input a valid email address!";
        flag++;
         }else
         {
            return  Captcharesult()
            return true;
         }

        }
    </script>




    Refer mydala view source:
    <script>
    function user()
    {
    var isflag=1;
    $('#emailidErr').html('');$('#cpasswordErr').html('');$('#passwordErr').html('');$('#mobilenoErr').html('');$('#dobErr').html('');$('#tcboxErr').html('');$('#captchaErr').html('');
      if($('#emailid').val()=='')
        {
            $('#emailid').addClass("red-border");
            $('#emailidErr').html('<p>Please Enter Email Id</p>');
            isflag++;
        }else{   
        var emailFilter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;    // Both work same:and are userful /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/
                if(!(emailFilter.test($('#emailid').val())))
                {
                    $('#emailid').addClass("red-border");
                    $('#emailid').val('');
                    $('#emailidErr').html('<p>Please Enter Valid Email Id</p>');
                    isflag++;       
                }
        }
        if($('#password').val()=='')
        {
            $('#password').addClass("red-border");
            $('#passwordErr').html('<p>Please Enter Password</p>');
            isflag++;
        }else{   
            var Password = $('#password').val();
            if(Password.length<6)
            {
                $('#passwordErr').html('<p>Please Enter Six digit in Password</p>');
                $('#password').addClass("red-border");   
                isflag++;   
            }
            if(Password!=$('#cpassword').val())
            {
                $('#cpassword').addClass("red-border");
                $('#cpasswordErr').html('<p>Please Enter Same Password in Confirm Password</p>');
                isflag++;
            }
        }   
       
        if($('#mobileno').val()!='' )
        {
            if(!($('#mobileno').val().match(/^[0-9]+$/)))
            {
                $('#mobileno').addClass("red-border");
                $('#mobilenoErr').html('<p>Please Enter Numeric Value in Mobile Number!</p>');
                isflag++;
            }
           
            var Mobile=$('#mobileno').val();
            if ((Mobile.length<10))
            {
                $('#mobilenoErr').html('<p>Please Enter Ten digit in Mobile Number!</p>');
                $('#mobileno').addClass("red-border");
                isflag++;
            }
            if ((Mobile.length>10))
            {
                $('#mobilenoErr').html('<p>Please Enter Ten digit in Mobile Number!</p>');
                  $('#mobileno').addClass("red-border");
                  isflag++;
            }
        }
        else
        {
            $('#mobileno').addClass("red-border");
            $('#mobilenoErr').html('<p>Please Enter Your Mobile Number</p>');
            isflag++;
        }
       if($('#cityid').val()=='')
        {
            $('#cityid').addClass("red-border");
            $('#cityidErr').html('<p>Please Select City</p>');
            isflag++;
        }
        if($('#date_dd').val()=="" && $('#date_mm').val()=="" && $('#date_yy').val()=="")
            {
                    if($('#date_dd').val()==""){$('#date_dd').addClass("red-border");}
                    if($('#date_mm').val()==""){$('#date_mm').addClass("red-border");}
                    if($('#date_yy').val()==""){$('#date_yy').addClass("red-border");}
                    $('#dobErr').html('<p>Please Select Date of Birth!</p>');
                    isflag++;
            }
           
           
            if($('#b_pincode').val()!='' )
            {
                if(!($('#b_pincode').val().match(/^[0-9]+$/)))
                {
                    $('#b_pincode').addClass("red-border");
                    $('#b_pincodeErr').html('<p>Please Enter Numeric Value in Zip Code!</p>');
                    isflag++;
                }
               
                var zipcode=$('#b_pincode').val();
                if ((zipcode.length<6))
                {
                    $('#b_pincodeErr').html('<p>Please Enter six digit in Zip Code!</p>');
                    $('#b_pincode').addClass("red-border");
                    isflag++;
                }
                if ((zipcode.length>6))
                {
                    $('#b_pincodeErr').html('<p>Please Enter six digit in Zip Code!</p>');
                      $('#b_pincode').addClass("red-border");
                      isflag++;
                }
            }
           
            if($('#captcha').val()==''){
                $('#captcha').addClass("red-border");
                $('#captchaErr').html('<p>Please Enter Verification code</p>');
                isflag++;
            }
           
            if(document.form_user.tcbox.checked == false)
            {
                $('#tcbox').addClass("red-border");
                $('#tcboxErr').html('<p>Please accept the T&C.</p>');
                isflag++;
            }
           
           if(isflag > 1){
             $('#loginerror').show();
             return false;
           }
        document.getElementById('form_user').submit();
        document.form_user.submit();
    }
    </script>

  3. Scroll button click -> to open a new window
    ctrl+u ->page view source
    ctrl+home->beginning of document
    ctrl+end->end of document

  4. if (!document.feedback.field.checked) {
        // box is not checked
        return false;
    }

  5. Websites tips & tricks

    Monday, 29 October 2012

    http://geteverything.org/
    http://www.brtricks.com
    http://www.woorank.com/en
    http://validator.w3.org



  6. <script>

    function checkemail(){
        //var testresults
    var str=document.getElementById('emailsub').value;
    var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
    if (filter.test(str))
    {
    //testresults=true
    return  newsletter()   // this to call another javascript function
    return true;

    }
    else{
    alert("Please input a valid email address!")
    //testresults=false
    return false;
    }
    //return (testresults)
    }
    </script>


    Refer : http://www.javascriptkit.com/script/script2/acheck.shtml


  7. Cakephp email!!

    Saturday, 27 October 2012


     public function emailcheck()
     {
             $this->Email->smtpOptions = array(
           'port'=>'465', 
           'timeout'=>'30',
           'host' => 'ssl://smtp.gmail.com',
           'username'=>'prathapskp@gmail.com',
           'password'=>'12.06.1989',
      );
        $this->Email->delivery = 'smtp';
            $this->Email->from = 'prathap <prathapskp@yahoo.com>';
    $this->Email->to = 'prathapskp@gmail.com';
    $this->Email->subject ='hello' ;
    // $this->Email->template = 'register';
    // $this->set('user', $this->data);
                 //$this->Email->delivery = 'debug';
               if($this->Email->send('Hello message body!'))
               {
                $this->redirect('/');
                
               }else
               {
                $this->Session->setFlash(__('error occured', true));
               }

        }

    }