whitebear
whitebear

Reputation: 12433

Make select box for Integer value

This code makes the normal form for integer.

  $form = $this->createFormBuilder($row)
        ->add('inputnumber',null,array('label' => 'please input number',
            'data' => '3'))

However I would like to make select box like below for the integer value.

<select name=inputnumber>
<option value=1>
<option value=2>
<option value=3 selected>
</select>

How can I do this?

Upvotes: 0

Views: 310

Answers (1)

Alexey B.
Alexey B.

Reputation: 12033

You can use choice field.

->add('inputnumber', 'choice', array(
    'choices' => array(1, 2, 3)
))

Upvotes: 1

Related Questions