MasoniteFramework / masonite4

Temporary Repository for a Masonite Rewrite for Masonite 4
14 stars 3 forks source link

Fix displaying errors #168

Closed josephmancuso closed 3 years ago

josephmancuso commented 3 years ago

idk how to display validation errors.

This is what i was trying and its not working:

@if session().get('errors'):
    @for key, error_list in session().get('errors').items()
        @for error in error_list
        <li>{{ error }}</li>

        @endfor
    @endfor
@endif
girardinsamuel commented 3 years ago

What are you doing in the controller ?

Marlysson commented 3 years ago

Does still the template language is jinja?

josephmancuso commented 3 years ago

It may be an issue with the inertia adapter trying to get these values. Maybe it's loading them into some inertia helper.

The view I am using is not inertia based so maybe we just need to wrap that code inside a request.is_inertia:

I will experiment more later

josephmancuso commented 3 years ago

This is fixed. Issue was a combination of issues in the session as well as how i was accessing sessions in my application