hi there,

im trying to create a rule which has a condition for evaluating a checkbox. i've added the checkbox from my own module via hook_form_alter like this (a little simplified):

function foo_form_alter($form_id, &$form)
{
    $form_id['invite'] = array(
      '#tree' => true,
      'body' => array(
        '#type' => 'fieldset',
        '#collapsible' => false,
        '#title' => 'Invitation',
        '#tree' => true,
        'users' => array(
          '#type' => 'textfield',
          '#title' => t('Recpt.')
        ),
        'message' => array(
          '#type' => 'textarea',
          '#title' => t('Message'),
          '#value' => t('blub'),
        ),
        'send' => array(
          '#type' => 'checkbox',
          '#title' => t('Send invitation on next save'),
          '#value' => 0
        ),
        '#collapsed' => false
      )
    );

  return $form_id;
}

i've activated form events and created a rule on form submission with a condition which checks the value of the checkbox. i've used "invite[body][send]" as the form id and checked for value "true", "1" and "on", but all evaluate to false.

Comments

klausi’s picture

check the weight of your module, it should be less than 20 (so that the rules_forms_form_alter() comes after your module).

mitchell’s picture

Status: Active » Closed (fixed)