Autofill product name into form

Hi, I’m trying to create a way in which a form field can be auto-filled with the name of the product they clicked from, like a quote button.
So if I click the button on a product page for a certain motorcycle, the form field of “motorcycle” already has the product name in it.
I appreciate any help, I’m new to code and I’m struggling.

To prefill the value you will need to use wixQuery and query the collection to find the relevant value.
https://www.wix.com/code/reference/wix-data.html#query
Check out these forum posts:
https://www.wix.com/corvid/forum/community-discussion/pre-fill-form-fields-with-values-from-previous-record
https://www.vorbly.com/Vorbly-Code/WIX-CODE-AUTO-FILL-FORM-WITH-USER-INPUTS
https://www.wix.com/corvid/forum/community-discussion/prefill-textbox-using-wixcode

You can also find a lot of posts on this matter if you browse the forum:
https://www.wix.com/corvid/forum/search/prefill
https://www.wix.com/corvid/forum/search/auto-fill

Good luck!

Hi! I’m having the same issue as Adam. None of the referenced posts work correctly. The closest is the Vorbly Code post, however, it fills in my field with the word “title” instead of referencing the title field in the dynamic database. I’ve read these posts extensively and most are wanting to fill in member data, and don’t quite work in my situation. If you have any other thoughts or advice, that would be very helpful!!

Greetings, I need to pick up the product name for a field on my form. This is already working for me:

$w ( “#input10” ). placeholder = “Product Name” ;

But now i need to change the producy name to a dynamic value that changes accordingly to the product displayed on the page .

Please open your own post and describe your issue in detail.
You can link this post if needed.

Here! https://www.wix.com/velo/forum/coding-with-velo/autofill-product-name-into-the-contact-form