I have a Postal Address field type (as defined by the addressfield contrib module) assigned to an entity. I'm using conditional fields to make that address field visible and required when another field on the form is set to a certain value.

When the dependent field is set to the desired value, conditional fields does show the address field and make it required. However, it is also make the Address 2 line required. I don't want Address 2 to be required. I'm spinning my wheels trying to figure out how to get it to not be required and I can't find a place to override it in a custom module.

I don't know whether this should be categorized as a bug in Conditional Fields (since when you make Postal Address required in other contexts it does not make Address 2 required) or if this is just "works as designed." In either case, I still need to figure out how to make the Address 2 not required.

I would appreciate some guidance as to:
a) Where I should patch conditional fields

or

b) Where I should write my own custom logic (I mean what hook or alter -- I know to put it in a custom module) to override the #required attribute of that element.

Comments

nancydru’s picture

I am getting the "required" flag, as you state. But it seems the field is not actually required.

dqd’s picture

Version: 7.x-3.0-alpha1 » 7.x-3.x-dev
Status: Active » Closed (outdated)

Thanks for the reports and all the efforts in here. But due to inactivity in this issue for years and because of the upcoming EOL of Drupal 7, I will close this issue on th way cleaning up the issue queue.

Feel free to re-open as "Needs review" if you found a solution or have a patch to be reported to help others.