How to pre-populate a form using a button from another page [SOLVED]

Hi,
anyone done this before ? When I have a lot of Products on the page, and I have a button for example “contact us for questions” and when you clic, then open a form, and inside that form there is automatically the product number the client want to ask somtehing about ?
So a lot of products, each product with a own site and only one contact form wich sync the product number ? :thinking:
tom

1 Like

The way you can do this is using URL Parameters.

So the button would link to the contact page but the url would also contain some values that a small script will grab and place in the form field you want to populate.

1 Like

Hi @Malachiman
Hä? :smile: Is there an example ?

I will PM you lol

great :+1:

Hi Pete, will you PM me also? :smile:

Hey @tom2 (and I guess @KBConcepts also :rofl::rofl:)

Here is a very basic example of how you can achieve this.

EDIT: Added a disabled attribute to the product field so it is read only.
Form_URL_Params.bloc (1.4 MB)

Specific solutions will be a freelance job :crazy_face: :crazy_face:

3 Likes

Thanks Pete :grinning: I thought it was going to be more difficult, but it’s not that hard.

You should have been able to make it then @KBConcepts :thinking: :grin: :joy:

There are actually more complicated ways to do it, especially if you want to support outdated browsers.

Also you could automate the URL Parma’s by grabbing text from the product page and forming the url with it when you click the contact button. But that sounds like freelance work :pleading_face:

FYI I renamed the thread, so it’s more descriptive and easier to find later.

Yes, I wouldn’t have any problem using Blocs to accomplish this. :wink:
Smart move, Pete renaming the thread

I have tried to get this to work but can’t. I must be missing something.

I have copied over the “code widget content” to my form, copied the URL content for the button and renamed one of the form fields “product”. Pressing the button takes you to the page which contains the form, but nothing is populated.

@stephend, can you post your project file and I will have a look.

Hi Stephend

You may of solved this already.

Take a look at the form page settings Add Code button, the javascript is in the footer section that controls the product field and catches the values from the post, in the example file Malachiman gave us.

Thank you Sir for the example file, very cool indeed.

Warren