What's new in Customer Journeys?

Connect and learn more!
Adding new fields with form validation — Cloud Customer Connect
You're almost there! Please answer a few more questions for access to the Applications content. Complete registration
Interested in joining? Complete your registration by providing Areas of Interest here. Register

Adding new fields with form validation

Received Response
edited Feb 5, 2020 8:56PM in Visual Builder Studio 4 comments


Need to create 1 new field and make it required... but the JavaScript code I need to edit is out of the box.


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();

Howdy, Stranger!

Log In

To view full details, sign in.


Don't have an account? Click here to get started!