diff --git a/python/gui/qgsattributeeditor.sip b/python/gui/qgsattributeeditor.sip
index 7689505..5a21b68 100644
--- a/python/gui/qgsattributeeditor.sip
+++ b/python/gui/qgsattributeeditor.sip
@@ -6,8 +6,8 @@ class QgsAttributeEditor : QObject
 #include <qgsattributeeditor.h>
 %End
   public:
-    QgsAttributeEditor( QObject *parent );
-    static QWidget *createAttributeEditor( QWidget *parent, QWidget *editor, QgsVectorLayer *vl, int idx, const QVariant &value );
+    QgsAttributeEditor( QObject *parent, QgsVectorLayer *vl, int idx );
+    static QWidget *createAttributeEditor( QWidget *parent, QWidget *editor, QgsVectorLayer *vl, qint64 fid, int idx, const QVariant &value );
     static bool retrieveValue( QWidget *widget, QgsVectorLayer *vl, int idx, QVariant &value );
     static bool setValue( QWidget *widget, QgsVectorLayer *vl, int idx, const QVariant &value );
 
diff --git a/src/app/qgsattributedialog.cpp b/src/app/qgsattributedialog.cpp
index e18294d..8fd5fa5 100644
--- a/src/app/qgsattributedialog.cpp
+++ b/src/app/qgsattributedialog.cpp
@@ -136,7 +136,7 @@ QgsAttributeDialog::QgsAttributeDialog( QgsVectorLayer *vl, QgsFeature *thepFeat
       QString myFieldName = vl->attributeDisplayName( it.key() );
       int myFieldType = field.type();
 
-      QWidget *myWidget = QgsAttributeEditor::createAttributeEditor( 0, 0, vl, it.key(), it.value() );
+      QWidget *myWidget = QgsAttributeEditor::createAttributeEditor( 0, 0, vl, mFeature->id(), it.key(), it.value() );
       if ( !myWidget )
         continue;
 
@@ -187,7 +187,7 @@ QgsAttributeDialog::QgsAttributeDialog( QgsVectorLayer *vl, QgsFeature *thepFeat
       if ( !myWidget )
         continue;
 
-      QgsAttributeEditor::createAttributeEditor( mDialog, myWidget, vl, it.key(), it.value() );
+      QgsAttributeEditor::createAttributeEditor( mDialog, myWidget, vl, mFeature->id(), it.key(), it.value() );
 
       if ( vl->editType( it.key() ) != QgsVectorLayer::Immutable )
       {
diff --git a/src/app/qgsmergeattributesdialog.cpp b/src/app/qgsmergeattributesdialog.cpp
index 6b3c50b..8f7e6e1 100644
--- a/src/app/qgsmergeattributesdialog.cpp
+++ b/src/app/qgsmergeattributesdialog.cpp
@@ -119,7 +119,7 @@ void QgsMergeAttributesDialog::createTableWidgetContents()
       QTableWidgetItem* attributeValItem = new QTableWidgetItem( attrs[idx].toString() );
       attributeValItem->setFlags( Qt::ItemIsEnabled | Qt::ItemIsSelectable );
       mTableWidget->setItem( i + 1, j, attributeValItem );
-      mTableWidget->setCellWidget( i + 1, j, QgsAttributeEditor::createAttributeEditor( mTableWidget, NULL, mVectorLayer, idx, attrs[idx] ) );
+      mTableWidget->setCellWidget( i + 1, j, QgsAttributeEditor::createAttributeEditor( mTableWidget, NULL, mVectorLayer, mFeatureList[i].id(), idx, attrs[idx] ) );
     }
   }
 
diff --git a/src/gui/attributetable/qgsattributetabledelegate.cpp b/src/gui/attributetable/qgsattributetabledelegate.cpp
index 1599f2b..c488b07 100644
--- a/src/gui/attributetable/qgsattributetabledelegate.cpp
+++ b/src/gui/attributetable/qgsattributetabledelegate.cpp
@@ -76,7 +76,7 @@ QWidget *QgsAttributeTableDelegate::createEditor(
   if ( !vl )
     return NULL;
 
-  QWidget *w = QgsAttributeEditor::createAttributeEditor( parent, 0, vl, fieldIdx( index ), index.model()->data( index, Qt::EditRole ) );
+  QWidget *w = QgsAttributeEditor::createAttributeEditor( parent, 0, vl, featureId( index ), fieldIdx( index ), index.model()->data( index, Qt::EditRole ) );
 
   if ( parent )
   {
diff --git a/src/gui/qgsattributeeditor.cpp b/src/gui/qgsattributeeditor.cpp
index 85a8286..8a45610 100644
--- a/src/gui/qgsattributeeditor.cpp
+++ b/src/gui/qgsattributeeditor.cpp
@@ -16,15 +16,15 @@
  ***************************************************************************/
 
 #include "qgsattributeeditor.h"
-#include <qgsvectorlayer.h>
-#include <qgsvectordataprovider.h>
-#include <qgsuniquevaluerenderer.h>
-#include <qgscategorizedsymbolrendererv2.h>
-#include <qgssymbol.h>
-#include <qgslonglongvalidator.h>
-#include <qgsfieldvalidator.h>
-#include <qgsmaplayerregistry.h>
-#include <qgslogger.h>
+
+#include "qgsvectorlayer.h"
+#include "qgsvectordataprovider.h"
+#include "qgsuniquevaluerenderer.h"
+#include "qgscategorizedsymbolrendererv2.h"
+#include "qgssymbol.h"
+#include "qgslonglongvalidator.h"
+#include "qgsfieldvalidator.h"
+#include "qgsmaplayerregistry.h"
 
 #include <QPushButton>
 #include <QLineEdit>
@@ -42,6 +42,7 @@
 #include <QSettings>
 #include <QDir>
 #include <QUuid>
+#include <QMenu>
 
 void QgsAttributeEditor::selectFileName()
 {
@@ -101,6 +102,16 @@ void QgsAttributeEditor::selectDate()
   }
 }
 
+void QgsAttributeEditor::resetToDefault()
+{
+  QWidget *w = qobject_cast<QWidget *>( parent() );
+  if ( w )
+  {
+    QVariant v( mLayer->dataProvider()->defaultValue( mIdx ) );
+    setValue( w, mLayer, mIdx, v );
+  }
+}
+
 QComboBox *QgsAttributeEditor::comboBox( QWidget *editor, QWidget *parent )
 {
   QComboBox *cb = NULL;
@@ -112,7 +123,7 @@ QComboBox *QgsAttributeEditor::comboBox( QWidget *editor, QWidget *parent )
   return cb;
 }
 
-QWidget *QgsAttributeEditor::createAttributeEditor( QWidget *parent, QWidget *editor, QgsVectorLayer *vl, int idx, const QVariant &value )
+QWidget *QgsAttributeEditor::createAttributeEditor( QWidget *parent, QWidget *editor, QgsVectorLayer *vl, QgsFeatureId fid, int idx, const QVariant &value )
 {
   if ( !vl )
     return NULL;
@@ -122,6 +133,8 @@ QWidget *QgsAttributeEditor::createAttributeEditor( QWidget *parent, QWidget *ed
   const QgsField &field = vl->pendingFields()[idx];
   QVariant::Type myFieldType = field.type();
 
+  QgsAttributeEditor *ae = new QgsAttributeEditor( 0, vl, idx );
+
   switch ( editType )
   {
     case QgsVectorLayer::UniqueValues:
@@ -471,9 +484,9 @@ QWidget *QgsAttributeEditor::createAttributeEditor( QWidget *parent, QWidget *ed
       if ( pb )
       {
         if ( editType == QgsVectorLayer::FileName )
-          connect( pb, SIGNAL( clicked() ), new QgsAttributeEditor( pb ), SLOT( selectFileName() ) );
+          connect( pb, SIGNAL( clicked() ), ae, SLOT( selectFileName() ) );
         if ( editType == QgsVectorLayer::Calendar )
-          connect( pb, SIGNAL( clicked() ), new QgsAttributeEditor( pb ), SLOT( selectDate() ) );
+          connect( pb, SIGNAL( clicked() ), ae, SLOT( selectDate() ) );
       }
     }
     break;
@@ -481,6 +494,11 @@ QWidget *QgsAttributeEditor::createAttributeEditor( QWidget *parent, QWidget *ed
 
   setValue( myWidget, vl, idx, value );
 
+  ae->setParent( myWidget );
+
+  if ( FID_IS_NEW( fid ) )
+    myWidget->installEventFilter( ae );
+
   return myWidget;
 }
 
@@ -588,70 +606,78 @@ bool QgsAttributeEditor::retrieveValue( QWidget *widget, QgsVectorLayer *vl, int
     text = le->text();
   }
 
-  switch ( theField.type() )
+  if ( !text.isEmpty() && text == vl->dataProvider()->defaultValue( idx ).toString() )
+  {
+    value = QVariant( text );
+    modified = true;
+  }
+  else
   {
-    case QVariant::Int:
+    switch ( theField.type() )
     {
-      bool ok;
-      int myIntValue = text.toInt( &ok );
-      if ( ok && !text.isEmpty() )
-      {
-        value = QVariant( myIntValue );
-        modified = true;
-      }
-      else if ( modified )
+      case QVariant::Int:
       {
-        value = QVariant();
+        bool ok;
+        int myIntValue = text.toInt( &ok );
+        if ( ok && !text.isEmpty() )
+        {
+          value = QVariant( myIntValue );
+          modified = true;
+        }
+        else if ( modified )
+        {
+          value = QVariant();
+        }
       }
-    }
-    break;
-    case QVariant::LongLong:
-    {
-      bool ok;
-      qlonglong myLongValue = text.toLong( &ok );
-      if ( ok && !text.isEmpty() )
+      break;
+      case QVariant::LongLong:
       {
-        value = QVariant( myLongValue );
-        modified = true;
+        bool ok;
+        qlonglong myLongValue = text.toLong( &ok );
+        if ( ok && !text.isEmpty() )
+        {
+          value = QVariant( myLongValue );
+          modified = true;
+        }
+        else if ( modified )
+        {
+          value = QVariant();
+        }
       }
-      else if ( modified )
+      case QVariant::Double:
       {
-        value = QVariant();
-      }
-    }
-    case QVariant::Double:
-    {
-      bool ok;
-      double myDblValue = text.toDouble( &ok );
-      if ( ok && !text.isEmpty() )
-      {
-        value = QVariant( myDblValue );
-        modified = true;
+        bool ok;
+        double myDblValue = text.toDouble( &ok );
+        if ( ok && !text.isEmpty() )
+        {
+          value = QVariant( myDblValue );
+          modified = true;
+        }
+        else if ( modified )
+        {
+          value = QVariant();
+        }
       }
-      else if ( modified )
+      break;
+      case QVariant::Date:
       {
-        value = QVariant();
+        QDate myDateValue = QDate::fromString( text, Qt::ISODate );
+        if ( myDateValue.isValid() && !text.isEmpty() )
+        {
+          value = myDateValue;
+          modified = true;
+        }
+        else if ( modified )
+        {
+          value = QVariant();
+        }
       }
-    }
-    break;
-    case QVariant::Date:
-    {
-      QDate myDateValue = QDate::fromString( text, Qt::ISODate );
-      if ( myDateValue.isValid() && !text.isEmpty() )
-      {
-        value = myDateValue;
+      break;
+      default: //string
         modified = true;
-      }
-      else if ( modified )
-      {
-        value = QVariant();
-      }
+        value = QVariant( text );
+        break;
     }
-    break;
-    default: //string
-      modified = true;
-      value = QVariant( text );
-      break;
   }
 
   return modified;
@@ -794,3 +820,22 @@ bool QgsAttributeEditor::setValue( QWidget *editor, QgsVectorLayer *vl, int idx,
 
   return true;
 }
+
+bool QgsAttributeEditor::eventFilter( QObject *obj, QEvent *event )
+{
+  QContextMenuEvent *cme = dynamic_cast<QContextMenuEvent *>( event );
+  if ( !cme )
+    return false;
+
+  QLineEdit *le = qobject_cast<QLineEdit *>( obj );
+  if ( le )
+  {
+    QMenu *menu = le->createStandardContextMenu();
+    connect( menu->addAction( tr( "Reset to default" ) ), SIGNAL( triggered() ), this, SLOT( resetToDefault() ) );
+    menu->setAttribute( Qt::WA_DeleteOnClose );
+    menu->popup( cme->globalPos() );
+    return true;
+  }
+
+  return false;
+}
diff --git a/src/gui/qgsattributeeditor.h b/src/gui/qgsattributeeditor.h
index 190740b..c80ed45 100644
--- a/src/gui/qgsattributeeditor.h
+++ b/src/gui/qgsattributeeditor.h
@@ -17,6 +17,8 @@
 #ifndef QGSATTRIBUTEEDITOR_H
 #define QGSATTRIBUTEEDITOR_H
 
+#include "qgsfeature.h"
+
 #include <QVariant>
 
 class QObject;
@@ -30,18 +32,26 @@ class GUI_EXPORT QgsAttributeEditor : public QObject
     Q_OBJECT
 
   public:
-    QgsAttributeEditor( QObject *parent ) : QObject( parent ) {};
-    static QWidget *createAttributeEditor( QWidget *parent, QWidget *editor, QgsVectorLayer *vl, int idx, const QVariant &value );
+    QgsAttributeEditor( QObject *parent, QgsVectorLayer *vl, int idx )
+        : QObject( parent )
+        , mLayer( vl )
+        , mIdx( idx )
+    {}
+    static QWidget *createAttributeEditor( QWidget *parent, QWidget *editor, QgsVectorLayer *vl, QgsFeatureId fid, int idx, const QVariant &value );
     static bool retrieveValue( QWidget *widget, QgsVectorLayer *vl, int idx, QVariant &value );
     static bool setValue( QWidget *widget, QgsVectorLayer *vl, int idx, const QVariant &value );
 
   private:
     static QComboBox *comboBox( QWidget *editor, QWidget *parent );
+    bool eventFilter( QObject *obj, QEvent *event );
+
+    QgsVectorLayer *mLayer;
+    int mIdx;
 
   public slots:
     void selectFileName();
     void selectDate();
+    void resetToDefault();
 };
 
-
 #endif
diff --git a/src/gui/qgsformannotationitem.cpp b/src/gui/qgsformannotationitem.cpp
index 4861971..72a4ffb 100644
--- a/src/gui/qgsformannotationitem.cpp
+++ b/src/gui/qgsformannotationitem.cpp
@@ -98,7 +98,7 @@ QWidget* QgsFormAnnotationItem::createDesignerWidget( const QString& filePath )
           QWidget* attWidget = widget->findChild<QWidget*>( fieldIt->name() );
           if ( attWidget )
           {
-            QgsAttributeEditor::createAttributeEditor( widget, attWidget, mVectorLayer, attIt.key(), attIt.value() );
+            QgsAttributeEditor::createAttributeEditor( widget, attWidget, mVectorLayer, mFeature, attIt.key(), attIt.value() );
           }
         }
       }
