What if I don't want a default value for an address field?

Comments

damien tournoud’s picture

You have to have at least a default country. Is the whole field required?

joachim’s picture

Yup. Probably because when the field is on a node it's required too.

FieldAPI bug perhaps?
FieldAPI should allow me to leave the whole default section of the settings form blank if I want no default.

perarnet’s picture

StatusFileSize
new1.09 KB

The fields were set to required. Attached is a patch fix

fago’s picture

StatusFileSize
new4.87 KB

hm, it should respect the instance settings for that. Attached fixes that by passing all hook_field_widget_form() parameters through:

fago’s picture

Status: Active » Needs review
rszrama’s picture

Status: Needs review » Fixed

fago's patch is brilliant, and it fixes some lower-cased trues and a side issue I'd noticed in addressfield_edit_form()'s arguments, too.

Great job - committed, and it made me realize recent fixes I made to get the widget form working properly on checkout / entity forms alike broke the widget form in the freaking field settings. Working on a fix now. : )

rszrama’s picture

(fwiw, fixed the issue I was having - also learned that an element's #array_parents is for finding its place in $form while #parents is for finding its values place in $form_state['values']. Very useful to know!)

Status: Fixed » Closed (fixed)

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