Laravel Nova - Can`t see validation error messages










1















I`m working on a project with Nova dashboard. For some reason I can`t see validation error messages.



If there is an validation error, I can see that as an exception in browser console. But not in Nova UI.



I can see success message, if all fields of form are input correctly.



I`m new to Nova, can anyone help me to debug this issue? I mean I don`t know where to look for to figure out this issue



Error trace from browser:




"errors":"Sorry, something went wrong.",
"exception":"Illuminate\Validation\ValidationException",
"message":"The given data was invalid.",
"trace":[
"file":"/home/ausvacs/public_html/nova/src/PerformsValidation.php",
"line":18,
"function":"validate",
"class":"Illuminate\Validation\Validator",
"type":"->",
"args":
]



Fields method of Agency nova model (Table name:agency):



public function fields(Request $request)

return [
ID::make()->sortable(),

Text::make('Name')
->sortable()
->rules('required', 'string'),

];



Error on browser console:



enter image description here



Exception on browser network tab:



enter image description here










share|improve this question



















  • 1





    Can you please provide the code & screenshots for more details

    – Saumini Navaratnam
    Nov 15 '18 at 4:48











  • I have added error trace and fields method of my Nova model.

    – Vineeth Vijayan
    Nov 15 '18 at 5:45











  • Your Nova resource code looks ok. Can you check the exception stack trace in laravel log file.

    – Saumini Navaratnam
    Nov 15 '18 at 5:58











  • I checked. Its looks like there is no entry in laravel.log for this issue. I tried updating Nova, but that also did`t make any difference.

    – Vineeth Vijayan
    Nov 15 '18 at 6:30











  • Can you provide the input values your are submitting

    – Saumini Navaratnam
    Nov 15 '18 at 7:05















1















I`m working on a project with Nova dashboard. For some reason I can`t see validation error messages.



If there is an validation error, I can see that as an exception in browser console. But not in Nova UI.



I can see success message, if all fields of form are input correctly.



I`m new to Nova, can anyone help me to debug this issue? I mean I don`t know where to look for to figure out this issue



Error trace from browser:




"errors":"Sorry, something went wrong.",
"exception":"Illuminate\Validation\ValidationException",
"message":"The given data was invalid.",
"trace":[
"file":"/home/ausvacs/public_html/nova/src/PerformsValidation.php",
"line":18,
"function":"validate",
"class":"Illuminate\Validation\Validator",
"type":"->",
"args":
]



Fields method of Agency nova model (Table name:agency):



public function fields(Request $request)

return [
ID::make()->sortable(),

Text::make('Name')
->sortable()
->rules('required', 'string'),

];



Error on browser console:



enter image description here



Exception on browser network tab:



enter image description here










share|improve this question



















  • 1





    Can you please provide the code & screenshots for more details

    – Saumini Navaratnam
    Nov 15 '18 at 4:48











  • I have added error trace and fields method of my Nova model.

    – Vineeth Vijayan
    Nov 15 '18 at 5:45











  • Your Nova resource code looks ok. Can you check the exception stack trace in laravel log file.

    – Saumini Navaratnam
    Nov 15 '18 at 5:58











  • I checked. Its looks like there is no entry in laravel.log for this issue. I tried updating Nova, but that also did`t make any difference.

    – Vineeth Vijayan
    Nov 15 '18 at 6:30











  • Can you provide the input values your are submitting

    – Saumini Navaratnam
    Nov 15 '18 at 7:05













1












1








1








I`m working on a project with Nova dashboard. For some reason I can`t see validation error messages.



If there is an validation error, I can see that as an exception in browser console. But not in Nova UI.



I can see success message, if all fields of form are input correctly.



I`m new to Nova, can anyone help me to debug this issue? I mean I don`t know where to look for to figure out this issue



Error trace from browser:




"errors":"Sorry, something went wrong.",
"exception":"Illuminate\Validation\ValidationException",
"message":"The given data was invalid.",
"trace":[
"file":"/home/ausvacs/public_html/nova/src/PerformsValidation.php",
"line":18,
"function":"validate",
"class":"Illuminate\Validation\Validator",
"type":"->",
"args":
]



Fields method of Agency nova model (Table name:agency):



public function fields(Request $request)

return [
ID::make()->sortable(),

Text::make('Name')
->sortable()
->rules('required', 'string'),

];



Error on browser console:



enter image description here



Exception on browser network tab:



enter image description here










share|improve this question
















I`m working on a project with Nova dashboard. For some reason I can`t see validation error messages.



If there is an validation error, I can see that as an exception in browser console. But not in Nova UI.



I can see success message, if all fields of form are input correctly.



I`m new to Nova, can anyone help me to debug this issue? I mean I don`t know where to look for to figure out this issue



Error trace from browser:




"errors":"Sorry, something went wrong.",
"exception":"Illuminate\Validation\ValidationException",
"message":"The given data was invalid.",
"trace":[
"file":"/home/ausvacs/public_html/nova/src/PerformsValidation.php",
"line":18,
"function":"validate",
"class":"Illuminate\Validation\Validator",
"type":"->",
"args":
]



Fields method of Agency nova model (Table name:agency):



public function fields(Request $request)

return [
ID::make()->sortable(),

Text::make('Name')
->sortable()
->rules('required', 'string'),

];



Error on browser console:



enter image description here



Exception on browser network tab:



enter image description here







laravel laravel-nova






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 23 '18 at 5:32







Vineeth Vijayan

















asked Nov 15 '18 at 4:44









Vineeth VijayanVineeth Vijayan

166212




166212







  • 1





    Can you please provide the code & screenshots for more details

    – Saumini Navaratnam
    Nov 15 '18 at 4:48











  • I have added error trace and fields method of my Nova model.

    – Vineeth Vijayan
    Nov 15 '18 at 5:45











  • Your Nova resource code looks ok. Can you check the exception stack trace in laravel log file.

    – Saumini Navaratnam
    Nov 15 '18 at 5:58











  • I checked. Its looks like there is no entry in laravel.log for this issue. I tried updating Nova, but that also did`t make any difference.

    – Vineeth Vijayan
    Nov 15 '18 at 6:30











  • Can you provide the input values your are submitting

    – Saumini Navaratnam
    Nov 15 '18 at 7:05












  • 1





    Can you please provide the code & screenshots for more details

    – Saumini Navaratnam
    Nov 15 '18 at 4:48











  • I have added error trace and fields method of my Nova model.

    – Vineeth Vijayan
    Nov 15 '18 at 5:45











  • Your Nova resource code looks ok. Can you check the exception stack trace in laravel log file.

    – Saumini Navaratnam
    Nov 15 '18 at 5:58











  • I checked. Its looks like there is no entry in laravel.log for this issue. I tried updating Nova, but that also did`t make any difference.

    – Vineeth Vijayan
    Nov 15 '18 at 6:30











  • Can you provide the input values your are submitting

    – Saumini Navaratnam
    Nov 15 '18 at 7:05







1




1





Can you please provide the code & screenshots for more details

– Saumini Navaratnam
Nov 15 '18 at 4:48





Can you please provide the code & screenshots for more details

– Saumini Navaratnam
Nov 15 '18 at 4:48













I have added error trace and fields method of my Nova model.

– Vineeth Vijayan
Nov 15 '18 at 5:45





I have added error trace and fields method of my Nova model.

– Vineeth Vijayan
Nov 15 '18 at 5:45













Your Nova resource code looks ok. Can you check the exception stack trace in laravel log file.

– Saumini Navaratnam
Nov 15 '18 at 5:58





Your Nova resource code looks ok. Can you check the exception stack trace in laravel log file.

– Saumini Navaratnam
Nov 15 '18 at 5:58













I checked. Its looks like there is no entry in laravel.log for this issue. I tried updating Nova, but that also did`t make any difference.

– Vineeth Vijayan
Nov 15 '18 at 6:30





I checked. Its looks like there is no entry in laravel.log for this issue. I tried updating Nova, but that also did`t make any difference.

– Vineeth Vijayan
Nov 15 '18 at 6:30













Can you provide the input values your are submitting

– Saumini Navaratnam
Nov 15 '18 at 7:05





Can you provide the input values your are submitting

– Saumini Navaratnam
Nov 15 '18 at 7:05












1 Answer
1






active

oldest

votes


















0














The issue was with in the Handler (app/Exceptions/Handler.php). Not sure if the previous developer updated this function. Anyway, the issues in this function are:



  • Status code returning in the event of validation exception is 400, thats needs to 422. Then only Vue components will display validation messages.

  • Also, in here the errors are pushed to "validation" index of "response" array. But Vue component is checking for "errors" index of "response" array.


public function render($request, Exception $exception)



The issue got fixed when I updated code to return error code as 422 in the event of validation exception and pushed errors into "errors" index of response instead of "validation" index.






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%2f53312555%2flaravel-nova-cant-see-validation-error-messages%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














    The issue was with in the Handler (app/Exceptions/Handler.php). Not sure if the previous developer updated this function. Anyway, the issues in this function are:



    • Status code returning in the event of validation exception is 400, thats needs to 422. Then only Vue components will display validation messages.

    • Also, in here the errors are pushed to "validation" index of "response" array. But Vue component is checking for "errors" index of "response" array.


    public function render($request, Exception $exception)



    The issue got fixed when I updated code to return error code as 422 in the event of validation exception and pushed errors into "errors" index of response instead of "validation" index.






    share|improve this answer



























      0














      The issue was with in the Handler (app/Exceptions/Handler.php). Not sure if the previous developer updated this function. Anyway, the issues in this function are:



      • Status code returning in the event of validation exception is 400, thats needs to 422. Then only Vue components will display validation messages.

      • Also, in here the errors are pushed to "validation" index of "response" array. But Vue component is checking for "errors" index of "response" array.


      public function render($request, Exception $exception)



      The issue got fixed when I updated code to return error code as 422 in the event of validation exception and pushed errors into "errors" index of response instead of "validation" index.






      share|improve this answer

























        0












        0








        0







        The issue was with in the Handler (app/Exceptions/Handler.php). Not sure if the previous developer updated this function. Anyway, the issues in this function are:



        • Status code returning in the event of validation exception is 400, thats needs to 422. Then only Vue components will display validation messages.

        • Also, in here the errors are pushed to "validation" index of "response" array. But Vue component is checking for "errors" index of "response" array.


        public function render($request, Exception $exception)



        The issue got fixed when I updated code to return error code as 422 in the event of validation exception and pushed errors into "errors" index of response instead of "validation" index.






        share|improve this answer













        The issue was with in the Handler (app/Exceptions/Handler.php). Not sure if the previous developer updated this function. Anyway, the issues in this function are:



        • Status code returning in the event of validation exception is 400, thats needs to 422. Then only Vue components will display validation messages.

        • Also, in here the errors are pushed to "validation" index of "response" array. But Vue component is checking for "errors" index of "response" array.


        public function render($request, Exception $exception)



        The issue got fixed when I updated code to return error code as 422 in the event of validation exception and pushed errors into "errors" index of response instead of "validation" index.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 23 '18 at 11:46









        Vineeth VijayanVineeth Vijayan

        166212




        166212





























            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%2f53312555%2flaravel-nova-cant-see-validation-error-messages%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