Jump to content

Autofill a contact form with a url query string

Recommended Posts

Posted

Site URL: https://vineyardcolumbus.org/contact-staff

It seems that a common problem with providing a staff page for large organizations is how to enable contact links for staff members' emails without endangering their inboxes with spam due to malicious email scrapers.

Squarespace does not currently provide an option for obfuscating or encrypting email addresses through the Link Editor. So my workaround for several clients has been to direct all "Contact Me" links to a single contact form on a separate page.

However, it would be nice if we could pass a url parameter through to auto-populate a field in that form such as "Who are you trying to reach?" to essentially fill in that field for the user based on whichever staff members' contact link they clicked to arrive there.

Here's the staff page I'm working on: https://vineyardcolumbus.org/our-leadership#leadership-campus-pastors-section where every Contact link directs to https://vineyardcolumbus.org/contact-staff 

My idea would involve setting the contact link for each staffer's gallery image (in the description field) as a text link with a href value of something similar to this: https://vineyardcolumbus.org/contact-staff?text-yui_3_17_2_1_1588078038493_298709-field=Charles%20Montgomery

where...
"text-yui_3_17_2_1_1588078038493_298709-field" is the id of the text field I want to populate (and though it contains a 'yui' seems to be a consistent id on any page load)

and...
"Charles%20Montgomery" is the value that would be plugged into that field if we clicked on Charles' contact link (and would display in the field as "Charles Montgomery")

So what javascript could I insert on the Contact Staff page or header code injection that might accomplish this? Any help would be greatly appreciated.

 

  • Replies 0
  • Views 1.5k
  • Created
  • Last Reply

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.