adamwathan / bootforms

Rapid form generation with Bootstrap 3 and Laravel.
MIT License
417 stars 103 forks source link

Keep getting exception when using BootForm::Select #44

Closed crazycodr closed 9 years ago

crazycodr commented 9 years ago

I'm using Laravel 5 (if that matter anyhow) to render a list of options to a template using

{!! BootForm::Select('Exalted type', $exaltedTypes->lists('name', 'id')) !!}

The value of my list of option is

array (size=5)
    1 => string 'Solars' (length=6)
    2 => string 'Terrestrials' (length=12)
    3 => string 'Sidereals' (length=9)
    4 => string 'Lunars' (length=6)
    5 => string 'Abyssals' (length=8)

And the error i keep getting is:

FatalErrorException in FormGroup.php line 0: Method AdamWathan\Form\Elements\Label::__toString() must not throw an exception in FormGroup.php line 0
at HandleExceptions->fatalExceptionFromError(array('type' => '1', 'message' => 'Method AdamWathan\Form\Elements\Label::__toString() must not throw an exception', 'file' =>  C:\wamp\www\exalted\vendor\adamwathan\bootforms\src\AdamWathan\BootForms\Elements\FormGroup.php', 'line' => '0')) in HandleExceptions.php line 116
at HandleExceptions->handleShutdown()

Do you have an idea of what might be wrong?

crazycodr commented 9 years ago

Just found the error, you might want to do some basic parameter checks such as $name not being an array. I was pushing to the SELECT method a list of options and creating a nameless control. This create an attribute list of name and id with an array value and thus contributed to this cryptic message.