2

I'm trying to add a class to a laravel form. The array is being passed as the third argument, as required, but I get the above error.

{{ Form::input('text', $variable->name, array('class' => 'form-control')) }}

If I get rid of the third argument, the form displays as expected (unstyled). I can't see what I'm doing wrong here - can anyone help?

3 Answers 3

6
{{ Form::text('text', $variable->name, array('class' => 'form-control')) }}
Sign up to request clarification or add additional context in comments.

2 Comments

Good point, OP shouldn't even be using Form::input(), but Form::text()
up-voted as the best answer. using Form::text is cleaner imo
2

I can see from the api that there is another argument expected:

http://laravel.com/api/source-class-Illuminate.Html.FormBuilder.html#235-246

('text', $name, $value, $options)

Comments

2

Your array needs to be the fourth argument to Form::input() - the third is the 'default' value. See Laravel's FormBuilder class:

public function input($type, $name, $value = null, $options = array())

Comments

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.