Adding new fields with form validation
Summary
Need to create 1 new field and make it required... but the JavaScript code I need to edit is out of the box.Content
Hello all,
I need to create a new field on a checkout page that is validated on an out of the box JavaScript file. I have tried making an extendedjs file and put the form validation code there, however, the out of the box code overwrites it. Is there any way to edit the out of the box JavaScript file or find it anywhere?
fyi: I am using knockout js.
Code Snippet
//code from the out of the box js file else if (i.order().shippingAddress().validateForShippingMethod()) { i.order().shippingAddress().firstName() == undefined && i.order().shippingAddress().firstName(""), i.order().shippingAddress().lastName() == undefined && i.order().shippingAddress().lastName(""), i.order().shippingAddress().address1() == undefined && i.order().shippingAddress().address1(""), i.order().shippingAddress().city() == undefined && i.order().shippingAddress().city(""), i.order().shippingAddress().phoneNumber() == undefined && i.order().shippingAddress().phoneNumber(""); if (i.cart().shippingAddress() == "" || i.cart().shippingMethod() == "" || i.cart().isShippingAddressChanged(i.order().shippingAddress().toJSON(), i.cart().shippingAddress().toJSON())) i.order().selectedShippingOption(""), $.Topic(r.topicNames.CHECKOUT_SHIPPING_ADDRESS_UPDATED).publish();
Tagged:
0