I am setting up a test site with some basic mapping modules installed. What is happening is that when I create a new field for a content type with field type: Geofield and Widget: OpenLayers map, and then try to save the field's setting when the 'Required' checkbox is marked, the system gives a message that "[my field] is required and must not be empty.", which doesn't make sense since I haven't tried yet to enter data into that field. I'm only trying to save the initial setup. The field settings cannot be saved unless I uncheck the 'Required' box.

Screenshots attached show the field setup and then the error message. All modules are up to date as of 2014-08-03

  • Drupal 7.30
  • Geofield 7.x-2.1
  • OpenLayers 7.x-2.0-beta9
  • Libraries 7.x-2.2
  • geoPHP 7.x-1.7
  • the geoPHP library 1.1, commit 478a1a0a57

It might be worth noting that I am following a tutorial from the O'Reilly book: "Mapping with Drupal" by Alan Palazzolo and Thomas Turnbull. I've developed dozens of Drupal sites but have never come across a field that couldn't be saved due to the 'Required' checkbox being selected.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

timos’s picture

Hi

Same with Latitude/Longitude widget

Tim

timos’s picture

Assigned: Unassigned » timos
timos’s picture

Hi

Here a patch fixing the issue for Latitude/Longitude widget, but i think is ok for all widget.

@rajmataj tell me if ok in your case

Actually, problem seems arise from the fix of https://www.drupal.org/node/1555854 implements a empty test for geofield data in a hook_field_validate() (called on entity create or edit form). But, as this hook is also called on field create or edit form, the test is done too.

The patch test the field's $instance array's structure to know if we are in a entity form context or in a field form context... so it's a bit ugly and maybe it should be better to refactor all the stuff but i don't have time right now.

Cheers

Tim

tisteegz’s picture

I feel like this is the same issue as https://www.drupal.org/node/1946058