fill input by url variable

i have blank form that i want to send to some distributor - i want to give every one of them different link to the same form and each link will fill automatic the “from” input .
google form call it “pre-fill link”

1 Like

Hey Oren,

Will sending the link with some query parameters work.

So you send something like this: www.mysite.com?test=value

And code something like this:

import wixLocation from 'wix-location';

$w.onReady(function () {
	console.log(wixLocation.query);
	$w("#myInput").value = wixLocation.query["test"];
});

Note: Depending on whether you connect your form to a dataset, you may also have to wrap the code in a dataset.onReady.

2 Likes

still dont working… :frowning:
i add this code to page :

import wixLocation from ‘wix-location’;

$w.onReady(function () {
console.log(wixLocation.query);
$w(“#club”).value = wixLocation.query[“club”];

});

the input ID i wanted to change is call “club” but i cannot see the word “value” there when i open this url :

http://48898232.wixsite.com/complex?club=value

I see that the console.log() is working. Are you sure the element’s ID is club? What type of element is it? (I don’t see where on the page you want it to go.)

working!!! thanks!!

hey @Sam

it does work but it takes like 5 to 7 seconds for the value to display in the input box.

is there a way to make this process faster

Hi Sam,

I have the exact same requirement; but I can’t get it to work.
I need to send a feedback form to multiple people and want the name, subject and location fields to get populated from information in the url.

Here is the form:
https://www.synapseassessments.in/feedbackform

Could you perhaps help with the code needed to for this and how to apply the code.

Thanks in advance