The options for the 'confirm form' flag link type are technically required, in that leaving them blank and submitting the form makes the form fail submission.

However, they are not marked as #required in the form array, so the user doesn't know they were required until they see the error message.

The reason for this is that they are hidden, and only shown if you pick the link type they go with. So making them #required would mean that they'd be required even when hidden and irrelevant -- which would be a huge UI bug!

But now on D7 we can achieve this with states: we already toggle visibility based on the link type checkbox; we can do the same with the 'required' property.

#1 KBjoachim
PASSED: [[SimpleTest]]: [MySQL] 266 pass(es). View
Members fund testing for the Drupal project. Drupal Association Learn more


joachim’s picture

Status: Active » Needs review
2.99 KB
PASSED: [[SimpleTest]]: [MySQL] 266 pass(es). View
socketwench’s picture

+++ b/includes/
@@ -536,6 +538,8 @@ function flag_form($form, &$form_state, $flag) {
+    // This will get change to a state by flag_link_type_options_states().

Shouldn't that be "changed"? Otherwise, looks good. Confirmed by manual testing.

socketwench’s picture

Status: Needs review » Needs work

Forgot to tag.

joachim’s picture

Status: Needs work » Fixed


Committed with that docs fix in 2 places & another docs tweak.

Status: Fixed » Closed (fixed)

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