How to prepopulate promo code field and any other field in infusionsoft order form

How can I prepopulate promo code field and any other field like name and email in order form. I findout some of the video but not sure from where i can get that code. If you guide me regarding this that would be great. This is the link for the video https://www.youtube.com/watch?v=5lfmNHItrUQ. Also I tried this solution but it is not working. Is there a way to pre-fill an order form?

Hi @Adam_R_Fromson,
You should be able to use the javascript code in your “HTML areas” of your order form theme. You can also add the javascript to each individual form by editing the form and clicking the “HTML area” tab. I don’t have a link to this specific code that was used in the video but I would recommend using searchParams. If you aren’t famiilar, this should also help you out.

For example, a purely javascript way to accomplish this MIGHT look something like:

window.onload = function() {
     var urlToParse = new URL(window.location);
     var promoCode = urlToParse.searchParams.get('promoCode');
     document.querySelector('#promoCode').value = promoCode;
  }
1 Like