1

I don't know. Simply I don't know. Why does the second codeblock work and check the checkboxes by default, but the first block isn't?

I need to pre-check bitmask flags and I can't/don't want to append strings or something.

    // THIS isn't working?!!

    $test1 = array(
        2 => 'tomato',
        4 => 'bitmask problem'
    );
    $test2 = array(2, 4);

    $form->addElement('multiCheckbox', 'flags', array(
            'label' => 'Flags',
            'value' => $test2,
            'multiOptions' => $test1,
        )
    );

    // THIS IS WORKING:

    $form->addElement ( 
        'multiCheckbox', 'servers2', 
        array (
            'label' => 'test',
            'value' => array('a', 'b'), // select these 2 values
            'multiOptions' => array(
                        'a' => 'aaaaa',
                        'b' => 'aaaaa',
                        'c' => 'aaaa',
                        )
        )
    );
1
  • 1
    Please post that as an answer and you'll have my upvote :-) Commented May 5, 2014 at 17:18

1 Answer 1

2
$form->addElement('multiCheckbox', 'flags', array(

This is causing the error. flags is kinda reserved word in Zend I guess. But I didn't get an error message and I have no other form elements or even variables called flags.

When I rename this, it works!

$form->addElement('multiCheckbox', 'matchingFlags', array(
Sign up to request clarification or add additional context in comments.

2 Comments

(You probably already know this, but just a reminder: please mark it as "accepted" so future visitors can easily identify the solution)
"You can accept your own answer in 2 days" =) I would love to know if others can reproduce this bug..

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.