Field widget value not able to save via ajax I am trying to create a custom field type widget with a ajax submit handler to save the value of the field to the database without saving the whole node. 

Here is my code hook_field_field_info().

function mymodule_field_info() {
  return array(
   'time_logger_time' =&gt; array(
   'label' =&gt; t('Time loger'),
   'description' =&gt; t('Custom Poutine Field'),
   'default_widget' =&gt; 'time_logger_time_widget',
   'default_formatter' =&gt; 'time_logger_default_formatter',
   ),
  );
 }


Than this is my  hook_field_widget_info()

function mymodule_field_widget_info() {
   return array(
   'time_logger_time_widget' =&gt; array(
   'label' =&gt; t('Default'),
   'field types' =&gt; array('time_logger_time'),
  ),
 );
}


And finally my hook_field_widget_form() looks like 

function mymodule_field_widget_form(&amp;$form, &amp;$form_state, $field, $instance, $langcode, $items, $delta, $element) {
    $value = isset($items[$delta]['id']) ? $items[$delta]['id'] : '';
     $element['id'] = array(
       '#type' =&gt; 'textfield', 
       '#size' =&gt; 6,
       '#default_value' =&gt; $value
      );

     $element[submit] = array(
      '#type' =&gt; 'button',
      '#value'=&gt;'Save',
      '#name' =&gt;  'submit-'. $delta,
      '#ajax' =&gt; array(
        'callback' =&gt; 'mymodule_ajax_handler',
        'effect' =&gt; 'fade',
       ),
   );
   return $element;
 }


Idea is when I click the save button in my widget form it will call my ajax callback load the node, set the value of my field and save the node as follows-

function mymodule_ajax_handler( $form, &amp;$form_state){
     $node = node_load(22);
     dsm( $node);
     $node_wrapper = entity_metadata_wrapper('node', $node);
     $node_wrapper-&gt;field_log-&gt;set(1);
     $node-&gt;save();
 }


But when I click button I am getting some error saying  "Notice: Undefined index: field_log in EntityStructureWrapper-&gt;getPropertyInfo() (line 334 of /var/www/html/mysite/sites/all/modules/contrib/entity/includes/entity.wrapper.inc)." 

If I change my field in the ajax callback to some other field in my content type its saving fine. Like below-

function mymodule_ajax_handler( $form, &amp;$form_state){
 $node = node_load(22);
 $node_wrapper = entity_metadata_wrapper('node', $node);
 $node_wrapper-&gt;some_other_field_from_my_content_type-&gt;set(1); //This works fine 
 $node-&gt;save();
}


Is there anything wrong in my widget form. 

Here is my field scheme if someone want to refer- 

function mymodule_field_schema($field) {
$schema = array();
$schema['columns']['id'] = array(
    'type' =&gt; 'varchar',
    'length' =&gt; 50,
    'not null' =&gt; FALSE
);
  return $schema;
}
There might be a few issues, but it hard to tell.

First make sure the field is actually on the node. (Source https://www.drupal.org/documentation/entity-metadata-wrappers):

function _wrapper_debug($w) {
  $values = array();
  foreach ($w-&gt;getPropertyInfo() as $key =&gt; $val) {
    $values[$key] = $w-&gt;$key-&gt;value();
  }
  return $values;
}

dpm(_wrapper_debug($some_wrapped_object));


If it is there, perhaps you made the field a multi value field (it can hold more then 1 value), in this case you need to assign it like this:

 $node_wrapper-&gt;field_log[]-&gt;set(1); // Note the extra []


If this does not solve the problem, have a look at the above metadata wrapper page. It comes with a lot of examples en explanations.