Creating a Submit Button

Problem

You want to create a submit button in your Blade template.

Solution

Use the Form::submit() method.

You don't have to pass any arguments.

{{ Form::submit() }}

The resulting HTML will be as follows.

<input type="submit">

You can specify the value as the first argument.

{{ Form::submit('Save') }}

Now the resulting HTML has a value.

<input type="submit" value="Save">

Use the second argument to add additional attributes.

{{ Form::submit('Save', array('class' => 'btn')) }}

And now resulting the submit button has a class.

<input class="btn" type="submit" value="Save">

Discussion

Nothing to discuss.

comments powered by Disqus