11.08.2017 Views

codebright

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Forms 163<br />

1 <br />

2<br />

3 {{ Form::open(array('url' => 'my/route')) }}<br />

4 {{ Form::label('bear', 'Bears are?') }}<br />

5 {{ Form::select('bear', array(<br />

6 'Panda' => array(<br />

7 'red' => 'Red',<br />

8 'black' => 'Black',<br />

9 'white' => 'White'<br />

10 ),<br />

11 'Character' => array(<br />

12 'pooh' => 'Pooh',<br />

13 'baloo' => 'Baloo'<br />

14 )<br />

15 ), 'black') }}<br />

16 {{ Form::close() }}<br />

We have added a new dimension to our values array. The top level of the array is now split between<br />

‘Panda’ and ‘Character’. These two groups will be represented by ‘optgroup’ element types within<br />

the drop-down.<br />

Here’s the generated source code.<br />

1 <br />

2<br />

3 <br />

6 <br />

8 Bears are?<br />

9 <br />

10 <br />

11 Red<br />

12 Black<br />

13 White<br />

14 <br />

15 <br />

16 Pooh<br />

17 Baloo<br />

18 <br />

19 <br />

20

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!