Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Nalysa 48 posts 269 karma points
    Jul 13, 2021 @ 08:18
    Nalysa
    0

    Vendr checkout empty validation summary

    Hi,

    We are using vendr v1.8.1 and vendr.checkout v1.2.0

    During the checkout process we entered a discount code which is invalid, but instead of getting the error message we have a validation summary which is a red div with no message inside

    enter image description here

    How can we fix this issue?

    Thanks

  • Matt Brailsford 4123 posts 22194 karma points MVP 9x c-trib
    Jul 13, 2021 @ 08:29
    Matt Brailsford
    0

    Is the box actually empty? Or is the text rendered but not shown (ie, could it be red in colour or something?)

  • Nalysa 48 posts 269 karma points
    Jul 13, 2021 @ 08:34
    Nalysa
    0

    It is a div with an empty list

    <div class="validation-summary-errors bg-red-500 p-4 rounded mb-4"><ul><li style="display:none"></li></ul></div>
    
  • Matt Brailsford 4123 posts 22194 karma points MVP 9x c-trib
    Jul 13, 2021 @ 08:56
    Matt Brailsford
    0

    Hmm, OK so it looks like we must have been trying to show the code validation error next to the code field at some point as we give the code error a specific associated field

    https://github.com/vendrhub/vendr-checkout/blob/dev/src/Vendr.Checkout/Web/Controllers/VendrCheckoutSurfaceController.cs#L44

    However in the validation summary, we seem to be excluding property errors

    https://github.com/vendrhub/vendr-checkout/blob/dev/src/Vendr.Checkout/Web/UI/App_Plugins/VendrCheckout/Views/VendrCheckoutMaster.cshtml#L202

    And I can't see anywhere in the discount code form anywhere where we try and render the code validation error

    https://github.com/vendrhub/vendr-checkout/blob/dev/src/Vendr.Checkout/Web/UI/App_Plugins/VendrCheckout/Views/VendrCheckoutInformationPage.cshtml

    If we are not specifically displaying the code error somewhere else, you can probably set the Html.ValidationSummary first argument to false and I think it should show the relevant error.

    Matt

  • Nalysa 48 posts 269 karma points
    Jul 13, 2021 @ 09:08
    Nalysa
    0

    Changing the first argument to "false" does makes the page show the error message, but when the checkout page is loaded we will directly have the red div without even doing anything

  • Matt Brailsford 4123 posts 22194 karma points MVP 9x c-trib
    Jul 13, 2021 @ 09:10
    Matt Brailsford
    0

    Then there must be something else going on.

    A validation summary shouldn't show itself unless there is an error on the page.

  • Nalysa 48 posts 269 karma points
    Jul 13, 2021 @ 09:17
    Nalysa
    100

    I found a topic on stackoverflow about validation summary https://stackoverflow.com/a/12111297

    Apparently there is a problem with this helper function and doing the thing suggested by the answer does fix this issue.

    But if this is the case, the it means that the vendr checkout package might need to be updated

    What is your opinion on this? or you have another suggestion?

  • Matt Brailsford 4123 posts 22194 karma points MVP 9x c-trib
    Jul 13, 2021 @ 09:22
    Matt Brailsford
    0

    Hmm, weird 🤔

    I wonder if just removing the first boolean arg fixes it? I find it pretty weird that this hasn't been raised by anyone else though.

    Happy to look at introducing the override if it's causing problems, but I guess you could add it as a class in the App_Code folder as an instant workaround and then update the VendrCheckoutMaster.cshtml file accordingly.

    This would save you having to upgrade the package for now.

    Matt

  • Nalysa 48 posts 269 karma points
    Jul 13, 2021 @ 09:44
    Nalysa
    0

    Removing the first boolean arg changed nothing. Still have the red div on page load.

    Doing a quick search on google, I found that some old posts (like very old threads from 2011 and 2013) mentioned this issue. I am not sure why it is not fixed though.

    For now I will just do a quick workaround as you said.

    Thanks Matt

  • Matt Brailsford 4123 posts 22194 karma points MVP 9x c-trib
    Jul 13, 2021 @ 10:45
    Matt Brailsford
    0

    Very strange.

    Glad you have a workaround nevertheless 👍

    Matt

Please Sign in or register to post replies

Write your reply to:

Draft