Report in this issue the field types and configurations that do not currently get populated when overwrite is disabled.

The current way this module determines if a form field has a value or not, is by sending the field's $form_state['input'] array to a recursive function that traverses the array looking for set values.

function _entityreference_autofill_field_has_input_value($field_input) {
  if (is_array($field_input)) {
    foreach ($field_input as $value) {
      if (_entityreference_autofill_field_has_input_value($value)) {
        return TRUE;
      }
    }
  }
  else {
    return !empty($field_input);
  }
}

Is there a better/more way to check that an arbitrary form field has an input value? Also, is there any situation where the current approach will not work, ie overwrite a field that already has a value or skip a field that has no input value?

Comments

jgullstr’s picture

Issue summary: View changes
jgullstr’s picture

Issue summary: View changes
jgullstr’s picture

Version: » 7.x-1.x-dev
Issue summary: View changes

Added code.

jgullstr’s picture

Issue summary: View changes

Changed approach.

jgullstr’s picture

Issue summary: View changes
jgullstr’s picture

Title: Checking if field values are set or not. » Empty fields not populating if overwrite is disabled.
Issue summary: View changes
jgullstr’s picture

Title: Empty fields not populating if overwrite is disabled. » Empty fields not populated when "overwrite" is disabled.
Status: Active » Postponed (maintainer needs more info)

  • Commit 2251385 on 7.x-1.x by jgullstr:
    Issue #2142343 by jgullstr: Use hook_field_is_empty to handle overwrite...
jgullstr’s picture

Status: Postponed (maintainer needs more info) » Fixed

I'll set this to "fixed" for now, latest commit should help solve this. Re-open if necessary.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

kris77’s picture

Overwrite only filled fields. If I have an empty field, that field is the previous value and do not clear.