Pre-populating a field on an Order Form

Second set of eyes, please!

In an Order form, I have this code which works except populating the First Name field on the form:

searchParams = new URLSearchParams(
pt_first = searchParams.get('first')
window.alert("first =" + pt_first)
document.getElementById('firstName').value = pt_first

When the page loads, a simple dialog indicates I have the correct value. However, the population of the name field does not work, and I do not get the final “Done” dialog (indicating that set the value probably died a horrible death.

This seems trivial. Please let me know what I am doing wrong. Thanks!


I’m not a coder and typically don’t do much with fields on forms due to being ornery, but the one thing that sticks out is the ‘firstName’ field value. Keap’s database would be “Contact.firstName” - may be the nuance of not including the “Contact.” At the beginning.


Thanks, Jeff -
I imagine that the value would eventually end up in "Contact.firstName,” but first I need to get it populated on the order form.