TheWebs
TheWebs

Reputation: 12913

Why is my laravel 5 rendering html as string instead of dom?

So I have written the following route:

Route::get('/login', function() {
    return View::make('login.form');
});

This is the view:

@extends('layouts.master')

@section('content')
    <div class="form-section">
        {{ Form::open(
                array(
                    'url' => 'login-submit',
                    'method' => 'POST'
                )
            )
        }}

            {{ Form::submit('Authorize With AisisPlatform') }}
        {{ Form::close() }}
@stop

This is exactly what I see when I look at the page:

<form method="POST" action="http://app-response.tracking/login-submit" accept-charset="UTF-8"><input name="_token" type="hidden" value="7xHzX20h1RZBnkTP2CRraZVsAfSQIfVP61mBiFtN"> <input type="submit" value="Authorize With AisisPlatform"> </form>

Um..... Shouldn't the form be well .... and actual form? Why did it render out the html as a string? How do I make it render the actual form submit button?

Upvotes: 3

Views: 1256

Answers (1)

lukasgeiter
lukasgeiter

Reputation: 153030

The default echo braces: {{ ... }} escape HTML by default, to prevent HTML injection.

You should use {!! .. !!} to print raw HTML. For example:

{!! Form::submit('Authorize With AisisPlatform') !!}

Upvotes: 5

Related Questions