Field validation in Widget Plugin - not working in OPC

8 meses atrás
I have fluid validation in my ModelValidator : BaseNopValidator.   Setting a breakpoint there shows that it runs for both regular and one page checkout.  But, I don't see any validation error message in the one page checkout.

The Widget's PublicInfo.cshtml has:
    <label asp-for="Amount">@T("OverrideAmount"):</label>
    <input type="text" asp-for="Amount" style="width:65px;" autocomplete="off" />
    <span asp-validation-for="Amount"></span>


What am I missing?
7 meses atrás
At what checkout step are you trying to add the widget?
7 meses atrás
At first glance, everything looks right and should work. I have a couple of questions:
what version of nopCommerce is used?
are errors displayed on multistep checkout?
if some non-standard theme is used, are errors displayed in the standard theme?
7 meses atrás
nopCommerce version 4.60.4
The widget shows on the Shipping Method selection step.
I'm not using any third party theme;  just the standard DefaultClean.
The widget appears fine in both multi-page and one-page.  It's just that the validation messages only appear in the multi-page, not the one-page.

In the one-page step, some validation does seem to be happening because it it won't let me continue to the next step if I enter an alpha char. It's just that I don't see any validation messages.  It's a numeric field and I validate if in the min/max range.  If I enter an alpha char it won't let me continue to next step.  But if I enter number out of range, it does let me continue.

In the browser dev tools Console tab, there are no error messages.  I do see on the Network tab that it calls OpcSaveShippingMethod.

If I enter a valid value and continue steps, I select Manual payment, and there if I don't enter valid credit card information, I do see the validation messages. (But this is a PaymentInfo cshtml, not a PublicInfo cshtml.)
7 meses atrás
Hi. We were able to reproduce the problem locally, and we understand that it arises from the fact that in the OPC the markup is inserted by JS after all event subscriptions have been completed. Unfortunately, we have not yet found a way to overcome this, but we continue to work in this direction.