Display issue in Laravel 5.5 registration form's errors










0















I created a registration form using make:auth command in Laravel 5.5. Its working alright but not showing errors when validation fails. I've checked many times that code to display errors exists in template but still getting this error.



Template Location:



resources/views/mybladetemplate


Method in Controller:



protected function validator(array $data)
string


RegistersUsers Trait:



public function register(Request $request)

$this->validator($request->all())->validate();

event(new Registered($user = $this->create($request->all())));

$this->guard()->login($user);

return $this->registered($request, $user)
?: redirect($this->redirectPath());



Registeration Form:



<form class="form-horizontal" method="POST" action=" route('register') ">
csrf_field()

<div class="form-group $errors->has('field1') ? ' has-error' : '' ">
<label for="name" class="col-md-4 control-label">Field Name</label>

<div class="col-md-6">
<input id="field1" type="text" class="form-control" name="field" value=" old('field1') " required autofocus>
@if ($errors->has('field1'))
<span class="help-block">
<strong> $errors->first('field1') </strong>
</span>
@endif
</div>
</div>

<div class="form-group $errors->has('emailField') ? ' has-error' : '' ">
<label for="email" class="col-md-4 control-label">E-Mail Address</label>

<div class="col-md-6">
<input id="emailField" type="email" class="form-control" name="emailField" value=" old('emailField') " required>

@if ($errors->has('emailField'))
<span class="help-block">
<strong> $errors->first('emailField') </strong>
</span>
@endif
</div>
</div>

<div class="form-group">
<label for="anotherfield" class="col-md-4 control-label">Another Field</label>

<div class="col-md-6">
<input id="anotherfield" type="text" class="form-control" name="anotherfield" value=" old('anotherfield') " />
</div>
</div>

<div class="form-group $errors->has('fieldPwd') ? ' has-error' : '' ">
<label for="fieldPwd" class="col-md-4 control-label">Password</label>

<div class="col-md-6">
<input id="fieldPwd" type="password" class="form-control" name="fieldPwd" required>

@if ($errors->has('fieldPwd'))
<span class="help-block">
<strong> $errors->first('fieldPwd') </strong>
</span>
@endif
</div>
</div>

<div class="form-group">
<label for="password-confirm" class="col-md-4 control-label">Confirm Password</label>

<div class="col-md-6">
<input id="password-confirm" type="password" class="form-control" name="password_confirmation" required>
</div>
</div>

<div class="form-group">
<div class="col-md-6 col-md-offset-4">
<button type="submit" class="btn btn-primary">
Register
</button>
</div>
</div>
</form>









share|improve this question






















  • Are there no errors showing for any of the fields or are only some errors missing?

    – Delena Malan
    Nov 13 '18 at 23:01











  • <?php print_r($errors); ?> At the top of your from and share output ?

    – C2486
    Nov 14 '18 at 4:52












  • @C2486 this is output after print_r IlluminateSupportViewErrorBag Object ( [bags:protected] => Array ( ) )

    – aishazafar
    Nov 14 '18 at 7:20











  • @DelenaMalan It is not showing any error

    – aishazafar
    Nov 14 '18 at 7:26











  • it should display error if validation fails

    – C2486
    Nov 14 '18 at 8:23















0















I created a registration form using make:auth command in Laravel 5.5. Its working alright but not showing errors when validation fails. I've checked many times that code to display errors exists in template but still getting this error.



Template Location:



resources/views/mybladetemplate


Method in Controller:



protected function validator(array $data)
string


RegistersUsers Trait:



public function register(Request $request)

$this->validator($request->all())->validate();

event(new Registered($user = $this->create($request->all())));

$this->guard()->login($user);

return $this->registered($request, $user)
?: redirect($this->redirectPath());



Registeration Form:



<form class="form-horizontal" method="POST" action=" route('register') ">
csrf_field()

<div class="form-group $errors->has('field1') ? ' has-error' : '' ">
<label for="name" class="col-md-4 control-label">Field Name</label>

<div class="col-md-6">
<input id="field1" type="text" class="form-control" name="field" value=" old('field1') " required autofocus>
@if ($errors->has('field1'))
<span class="help-block">
<strong> $errors->first('field1') </strong>
</span>
@endif
</div>
</div>

<div class="form-group $errors->has('emailField') ? ' has-error' : '' ">
<label for="email" class="col-md-4 control-label">E-Mail Address</label>

<div class="col-md-6">
<input id="emailField" type="email" class="form-control" name="emailField" value=" old('emailField') " required>

@if ($errors->has('emailField'))
<span class="help-block">
<strong> $errors->first('emailField') </strong>
</span>
@endif
</div>
</div>

<div class="form-group">
<label for="anotherfield" class="col-md-4 control-label">Another Field</label>

<div class="col-md-6">
<input id="anotherfield" type="text" class="form-control" name="anotherfield" value=" old('anotherfield') " />
</div>
</div>

<div class="form-group $errors->has('fieldPwd') ? ' has-error' : '' ">
<label for="fieldPwd" class="col-md-4 control-label">Password</label>

<div class="col-md-6">
<input id="fieldPwd" type="password" class="form-control" name="fieldPwd" required>

@if ($errors->has('fieldPwd'))
<span class="help-block">
<strong> $errors->first('fieldPwd') </strong>
</span>
@endif
</div>
</div>

<div class="form-group">
<label for="password-confirm" class="col-md-4 control-label">Confirm Password</label>

<div class="col-md-6">
<input id="password-confirm" type="password" class="form-control" name="password_confirmation" required>
</div>
</div>

<div class="form-group">
<div class="col-md-6 col-md-offset-4">
<button type="submit" class="btn btn-primary">
Register
</button>
</div>
</div>
</form>









share|improve this question






















  • Are there no errors showing for any of the fields or are only some errors missing?

    – Delena Malan
    Nov 13 '18 at 23:01











  • <?php print_r($errors); ?> At the top of your from and share output ?

    – C2486
    Nov 14 '18 at 4:52












  • @C2486 this is output after print_r IlluminateSupportViewErrorBag Object ( [bags:protected] => Array ( ) )

    – aishazafar
    Nov 14 '18 at 7:20











  • @DelenaMalan It is not showing any error

    – aishazafar
    Nov 14 '18 at 7:26











  • it should display error if validation fails

    – C2486
    Nov 14 '18 at 8:23













0












0








0








I created a registration form using make:auth command in Laravel 5.5. Its working alright but not showing errors when validation fails. I've checked many times that code to display errors exists in template but still getting this error.



Template Location:



resources/views/mybladetemplate


Method in Controller:



protected function validator(array $data)
string


RegistersUsers Trait:



public function register(Request $request)

$this->validator($request->all())->validate();

event(new Registered($user = $this->create($request->all())));

$this->guard()->login($user);

return $this->registered($request, $user)
?: redirect($this->redirectPath());



Registeration Form:



<form class="form-horizontal" method="POST" action=" route('register') ">
csrf_field()

<div class="form-group $errors->has('field1') ? ' has-error' : '' ">
<label for="name" class="col-md-4 control-label">Field Name</label>

<div class="col-md-6">
<input id="field1" type="text" class="form-control" name="field" value=" old('field1') " required autofocus>
@if ($errors->has('field1'))
<span class="help-block">
<strong> $errors->first('field1') </strong>
</span>
@endif
</div>
</div>

<div class="form-group $errors->has('emailField') ? ' has-error' : '' ">
<label for="email" class="col-md-4 control-label">E-Mail Address</label>

<div class="col-md-6">
<input id="emailField" type="email" class="form-control" name="emailField" value=" old('emailField') " required>

@if ($errors->has('emailField'))
<span class="help-block">
<strong> $errors->first('emailField') </strong>
</span>
@endif
</div>
</div>

<div class="form-group">
<label for="anotherfield" class="col-md-4 control-label">Another Field</label>

<div class="col-md-6">
<input id="anotherfield" type="text" class="form-control" name="anotherfield" value=" old('anotherfield') " />
</div>
</div>

<div class="form-group $errors->has('fieldPwd') ? ' has-error' : '' ">
<label for="fieldPwd" class="col-md-4 control-label">Password</label>

<div class="col-md-6">
<input id="fieldPwd" type="password" class="form-control" name="fieldPwd" required>

@if ($errors->has('fieldPwd'))
<span class="help-block">
<strong> $errors->first('fieldPwd') </strong>
</span>
@endif
</div>
</div>

<div class="form-group">
<label for="password-confirm" class="col-md-4 control-label">Confirm Password</label>

<div class="col-md-6">
<input id="password-confirm" type="password" class="form-control" name="password_confirmation" required>
</div>
</div>

<div class="form-group">
<div class="col-md-6 col-md-offset-4">
<button type="submit" class="btn btn-primary">
Register
</button>
</div>
</div>
</form>









share|improve this question














I created a registration form using make:auth command in Laravel 5.5. Its working alright but not showing errors when validation fails. I've checked many times that code to display errors exists in template but still getting this error.



Template Location:



resources/views/mybladetemplate


Method in Controller:



protected function validator(array $data)
string


RegistersUsers Trait:



public function register(Request $request)

$this->validator($request->all())->validate();

event(new Registered($user = $this->create($request->all())));

$this->guard()->login($user);

return $this->registered($request, $user)
?: redirect($this->redirectPath());



Registeration Form:



<form class="form-horizontal" method="POST" action=" route('register') ">
csrf_field()

<div class="form-group $errors->has('field1') ? ' has-error' : '' ">
<label for="name" class="col-md-4 control-label">Field Name</label>

<div class="col-md-6">
<input id="field1" type="text" class="form-control" name="field" value=" old('field1') " required autofocus>
@if ($errors->has('field1'))
<span class="help-block">
<strong> $errors->first('field1') </strong>
</span>
@endif
</div>
</div>

<div class="form-group $errors->has('emailField') ? ' has-error' : '' ">
<label for="email" class="col-md-4 control-label">E-Mail Address</label>

<div class="col-md-6">
<input id="emailField" type="email" class="form-control" name="emailField" value=" old('emailField') " required>

@if ($errors->has('emailField'))
<span class="help-block">
<strong> $errors->first('emailField') </strong>
</span>
@endif
</div>
</div>

<div class="form-group">
<label for="anotherfield" class="col-md-4 control-label">Another Field</label>

<div class="col-md-6">
<input id="anotherfield" type="text" class="form-control" name="anotherfield" value=" old('anotherfield') " />
</div>
</div>

<div class="form-group $errors->has('fieldPwd') ? ' has-error' : '' ">
<label for="fieldPwd" class="col-md-4 control-label">Password</label>

<div class="col-md-6">
<input id="fieldPwd" type="password" class="form-control" name="fieldPwd" required>

@if ($errors->has('fieldPwd'))
<span class="help-block">
<strong> $errors->first('fieldPwd') </strong>
</span>
@endif
</div>
</div>

<div class="form-group">
<label for="password-confirm" class="col-md-4 control-label">Confirm Password</label>

<div class="col-md-6">
<input id="password-confirm" type="password" class="form-control" name="password_confirmation" required>
</div>
</div>

<div class="form-group">
<div class="col-md-6 col-md-offset-4">
<button type="submit" class="btn btn-primary">
Register
</button>
</div>
</div>
</form>






php laravel laravel-5.5






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 13 '18 at 17:16









aishazafaraishazafar

3272521




3272521












  • Are there no errors showing for any of the fields or are only some errors missing?

    – Delena Malan
    Nov 13 '18 at 23:01











  • <?php print_r($errors); ?> At the top of your from and share output ?

    – C2486
    Nov 14 '18 at 4:52












  • @C2486 this is output after print_r IlluminateSupportViewErrorBag Object ( [bags:protected] => Array ( ) )

    – aishazafar
    Nov 14 '18 at 7:20











  • @DelenaMalan It is not showing any error

    – aishazafar
    Nov 14 '18 at 7:26











  • it should display error if validation fails

    – C2486
    Nov 14 '18 at 8:23

















  • Are there no errors showing for any of the fields or are only some errors missing?

    – Delena Malan
    Nov 13 '18 at 23:01











  • <?php print_r($errors); ?> At the top of your from and share output ?

    – C2486
    Nov 14 '18 at 4:52












  • @C2486 this is output after print_r IlluminateSupportViewErrorBag Object ( [bags:protected] => Array ( ) )

    – aishazafar
    Nov 14 '18 at 7:20











  • @DelenaMalan It is not showing any error

    – aishazafar
    Nov 14 '18 at 7:26











  • it should display error if validation fails

    – C2486
    Nov 14 '18 at 8:23
















Are there no errors showing for any of the fields or are only some errors missing?

– Delena Malan
Nov 13 '18 at 23:01





Are there no errors showing for any of the fields or are only some errors missing?

– Delena Malan
Nov 13 '18 at 23:01













<?php print_r($errors); ?> At the top of your from and share output ?

– C2486
Nov 14 '18 at 4:52






<?php print_r($errors); ?> At the top of your from and share output ?

– C2486
Nov 14 '18 at 4:52














@C2486 this is output after print_r IlluminateSupportViewErrorBag Object ( [bags:protected] => Array ( ) )

– aishazafar
Nov 14 '18 at 7:20





@C2486 this is output after print_r IlluminateSupportViewErrorBag Object ( [bags:protected] => Array ( ) )

– aishazafar
Nov 14 '18 at 7:20













@DelenaMalan It is not showing any error

– aishazafar
Nov 14 '18 at 7:26





@DelenaMalan It is not showing any error

– aishazafar
Nov 14 '18 at 7:26













it should display error if validation fails

– C2486
Nov 14 '18 at 8:23





it should display error if validation fails

– C2486
Nov 14 '18 at 8:23












1 Answer
1






active

oldest

votes


















0














Use this simple code in your blade to show all of the errors in a ul li structure :



 @if($errors->any())
@foreach ($errors->all() as $error)
<div class="alert alert-warning" dir="rtl">
<ul>
<li>!! $error !!</li>
</ul>
</div>
@endforeach
@endif





share|improve this answer






















    Your Answer






    StackExchange.ifUsing("editor", function ()
    StackExchange.using("externalEditor", function ()
    StackExchange.using("snippets", function ()
    StackExchange.snippets.init();
    );
    );
    , "code-snippets");

    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "1"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53286352%2fdisplay-issue-in-laravel-5-5-registration-forms-errors%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    Use this simple code in your blade to show all of the errors in a ul li structure :



     @if($errors->any())
    @foreach ($errors->all() as $error)
    <div class="alert alert-warning" dir="rtl">
    <ul>
    <li>!! $error !!</li>
    </ul>
    </div>
    @endforeach
    @endif





    share|improve this answer



























      0














      Use this simple code in your blade to show all of the errors in a ul li structure :



       @if($errors->any())
      @foreach ($errors->all() as $error)
      <div class="alert alert-warning" dir="rtl">
      <ul>
      <li>!! $error !!</li>
      </ul>
      </div>
      @endforeach
      @endif





      share|improve this answer

























        0












        0








        0







        Use this simple code in your blade to show all of the errors in a ul li structure :



         @if($errors->any())
        @foreach ($errors->all() as $error)
        <div class="alert alert-warning" dir="rtl">
        <ul>
        <li>!! $error !!</li>
        </ul>
        </div>
        @endforeach
        @endif





        share|improve this answer













        Use this simple code in your blade to show all of the errors in a ul li structure :



         @if($errors->any())
        @foreach ($errors->all() as $error)
        <div class="alert alert-warning" dir="rtl">
        <ul>
        <li>!! $error !!</li>
        </ul>
        </div>
        @endforeach
        @endif






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 14 '18 at 6:37









        RezasysRezasys

        658




        658





























            draft saved

            draft discarded
















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53286352%2fdisplay-issue-in-laravel-5-5-registration-forms-errors%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Use pre created SQLite database for Android project in kotlin

            Darth Vader #20

            Ondo