Home Forums Community Forum Passing URL params into avada forms

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • bkling
    Post count: 1

    Is it possible to pass in query params from the URL to prefill form fields? I know you can scrape them using a hidden field, but i want to map to visible fields the user has to enter.

    For example, i want to send a customer a check-in form that already has his name and email filled out in the form fields, by sending them a URL such as:


    and it should fill in:
    Name: bob
    Email: bob@aol.com

    so the user does not have to type it.

    Post count: 816


    I don’t think Avada Forms has built-in support for that yet. But, it’s pretty straightforward with JavaSript.

    Here’s an example of auto-filling an email field with a get query parameter

     * Fill in a form field using a get query parameter.
     * Example URL: http://avada.local/test-form/?email=test%40test.co
     * Result: Email test@test.co
      	if (!document.URL.includes("test-form")) return; // Run on test-form page only.
      	const emailElt = document.querySelector("#email");
      	if (!emailElt) return; // If no email field, bail.
      	const urlParams = new URLSearchParams(window.location.search);
    	//const emailVal = decodeURIComponent(urlParams.get('email')); Uncomment if needed.
    	const emailVal = urlParams.get('email');
    	console.log("Filling in the email field with: " + emailVal);
    	if (emailVal) emailElt.value = emailVal;

    Tweak as needed.

    Add this to the footer area of your pages using Avada code options or a snippets plugin.


    Post count: 3

    Thank you for the code @marklchaves, I will be really thankful and appreciate if you can help me too.

    I have a WP page with URL like http://abc.com/deal/?fname=FirstName&?lname=LastName&?somevar=SomeVariable, I want the landing page to greet user with his First and Last Name and the variable.

    How can this be done, I am completely new to AVADA and WP, Can you please help out here?

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.