+ Start a Discussion
Samuel RobertSamuel Robert 

unable to save Record in Custom object

/-- Below is my Visual force page coding.

<apex:page Controller="CreateAccount" >

<head>
  <meta charset="utf-8"/>
  <title>jQuery UI Datepicker - Default functionality</title>
  <link rel="stylesheet" href="//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css"/>
  <script src="//code.jquery.com/jquery-1.10.2.js"></script>
  <script src="//code.jquery.com/ui/1.11.4/jquery-ui.js"></script>
  <link rel="stylesheet" href="/resources/demos/style.css"/>

  <script>
  $(function() {
    $( "#datepicker" ).datepicker();
  });
  </script>
</head>
<body>
 

 
</body>

<apex:stylesheet value="http://www.pageresource.com/wallpapers/wallpaper/latest-google-hd.jpg"/>
 <apex:form id="form">
 <div align="center" draggable="false" >
 <apex:image url="http://googlezone.ru/wp-content/uploads/2014/11/101020141429292562322.jpg" width="120" height="50"/>
 </div>
 <apex:pageBlock title="Create your Google Account" mode="edit"  id="pgblock"> 
 <apex:pageBlockSection >
 
 Firstname <apex:inputtext value="{!Firstname}"/>
 Lastname <apex:inputtext value="{!Lastname}"/>
 Username <apex:inputtext value="{!Username}"/>
 Password <apex:inputtext value="{!Password}"/>
 Retypepassword <apex:inputtext value="{!Retypepassword}"/>
 MobilePhone <apex:inputtext value="{!MobilePhone}"/>
 Email <apex:inputtext value="{!Email}"/>
 DateOfBirth <input type="text"  id="datepicker"/>
 </apex:pageBlockSection>
 <apex:commandButton action="{!saveRecord}" style="float:centre" styleClass="button" value="Save" id="recordID"  />
 </apex:pageBlock>
 </apex:form>
</apex:page>


Apex Class

public with sharing class CreateAccount {

    public PageReference saveRecord() {
       
 GoogleBlog__c blog = new GoogleBlog__c();
    blog.FirstName__c= Firstname;
    blog.Lastname__c= Lastname;
    blog.Password__c= Password;
    blog.RetypePassword__c= Retypepassword;
    blog.Username__c= Username;
    blog.MobilePhone__c= MobilePhone;
    blog.Email__c= Email;
    Date.valueOf(DateOfBirth);
    insert blog;
    system.debug('!!!!!!!!!!' + blog);
  return null;
  
    }

    public String getContact() {
        return null;
    }


Public string Firstname {get;set;}
Public string Lastname {get;set;}
Public string Username {get;set;}
Public string Password {get;set;}
Public string Retypepassword {get;set;}
Public string MobilePhone {get;set;}
Public string Email {get;set;}
Public string DateOfBirth {get;set;}
}

When i try to save a Recod it throws me error like this, Can anyone suggest me what is the mistake in this
ERROR :
Visualforce ErrorHelp for this Page
System.NullPointerException: Argument cannot be null.
Error is in expression '{!saveRecord}' in component <apex:commandButton> in page createaccount: Class.CreateAccount.saveRecord: line 13, column 1
Class.CreateAccount.saveRecord: line 13, column 1