I built a custom form and one of them is of type geocode with lat/lon fields. When I try to save the node I receive the following error:
Cannot use object of type stdClass as array in /var/www/vhosts/example.com/httpdocs/modules/field/field.attach.inc on line 208n’.
The error disappears when I put comments in this field. My question is how can I solve this since it is very important field (I try to create nodes with geocode locations)
Here is how I declare my field:
$form['field_locationmap'] = array( '#title' => 'geofield', '#type' => 'geofield_latlon', );
It seems that the error occurs when I m trying to pass the values to the object:
$location->field_locationmap->und->{0}->geom->lon=$form_state['values']['field_locationmap']['lon']; $location->field_locationmap->und->{0}->geom->lat=$form_state['values']['field_locationmap']['lat'];