0

I created a custom credit card payment method and I want to trigger the validation of billing address fields when "Place order" button is clicked.

3 Answers 3

0

You need to do the following things.

  1. Insert validation classes into each fields of form.

  2. Insert the validation bind on the form tag.

0

After spending a lot of time digging Magento 2's core code, I found a way to trigger the billing address form fields validation programatically.

let billingAddressComponent = require('uiRegistry').get('checkout.steps.billing-step.payment.payments-list.'+this.getCode()+'-form');
billingAddressComponent.updateAddress();
0

Perfect answer(last one). But, provided component doesn`t work for me. So I find the proper component (with billing address) with

require('uiRegistry').get(function(component){console.log(component.name)});

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.