cancel
Showing results for 
Search instead for 
Did you mean: 

How can I generate a HTML form using XML?

SOLVED

How can I generate a HTML form using XML?

I want to place a form in the payment method of the checkout billing method, so I was wondering if overriding the magento/module-offline-payments/view/frontend/web/template/payment/checkmo.html file and placing my own form inside it was a good way to approach this.

 

Is there a way to create the HTML form without needing to override the core file? I want this form to only appear inside of the Check / Money Order.

I have tried following this tutorial but I cant seem to find the Check / Money Order method in the checkout_index_index.xml file, on top of that the tutorial doesn't explain how I can process the POST data(placing the data in the a DB in this case)

 

 

1 ACCEPTED SOLUTION

Accepted Solutions

Re: How can I generate a HTML form using XML?

@barisurhan

 

Please check below file

 

Magento\OfflinePayments\view\frontend\web\js\view\payment\method-renderer\purchaseorder-method.js

where they are passing 

{
"method": this.item.method,
 'po_number': this.purchaseOrderNumber(),
 "additional_data": null
}

you can pass your data into additional_data.

 

Hope it will help you.


Problem solved? Click Kudos & Accept as Solution!
Sunil Patel
Magento 2 Certified Professional Developer & Frontend Developer

View solution in original post

3 REPLIES 3

Re: How can I generate a HTML form using XML?

@barisurhan

 

you can copy same file into your theme, so no need to touch that magento original file, for pass extra info you need to study extension attributes.

 

 


Problem solved? Click Kudos & Accept as Solution!
Sunil Patel
Magento 2 Certified Professional Developer & Frontend Developer

Re: How can I generate a HTML form using XML?

I am going to override that file in my module. What do you mean with "for pass extra info"? And telling me to study isn't really helping me out, can you provide me a link where I can find information about this subject?

Re: How can I generate a HTML form using XML?

@barisurhan

 

Please check below file

 

Magento\OfflinePayments\view\frontend\web\js\view\payment\method-renderer\purchaseorder-method.js

where they are passing 

{
"method": this.item.method,
 'po_number': this.purchaseOrderNumber(),
 "additional_data": null
}

you can pass your data into additional_data.

 

Hope it will help you.


Problem solved? Click Kudos & Accept as Solution!
Sunil Patel
Magento 2 Certified Professional Developer & Frontend Developer