Writing a patch to allow unsetting form elements.

Comments

ronaldmulero’s picture

Status: Active » Needs review
StatusFileSize
new60.63 KB
new4.83 KB

Here's the patch.
Created with git format-patch

How it works:

For example, to unset the option "Armed Forces (Americas)" from the "State" select list that is provided by the Address Field module (set with United States as the default country) when it's used in the Profile2 main form:

Use devel to find:
['system_main']['profile_main']['field_org_address']['und'][0]['locality_block']['administrative_area']['#options']['AA']

Then use that info to fill out the Reaction > Form Alteration:
FORM ID: user_profile_form
PARENTS: profile_main, field_org_address, und, 0, locality_block, administrative_area
ATTRIBUTE: #options
VALUE: AA
UNSET: (checked)

Save.

And voilà, the option will no longer appear in the dropdown selectlist of the main profile form.

ronaldmulero’s picture

Assigned: ronaldmulero » Unassigned

Unassigning

doublejosh’s picture

Great addition. Putting on my list.