Passing data from a text field to an input field

Hi
I have 2 datasets, 1 that contains product details (called dynamicDataset) and 1 that will contain customer contact (called dataset1).

When the customer wants to enquire about a product they click on a button that takes them to our contact form, I can pull through the product details from the dynamicDataset into the screen however these will not pull into my form, so I would have enquiries from customers but not know which product they were for. I have therefore created corresponding input fields to collect this data but cannot get these to work.
for for example:
dynamicDataset dataset1
Product Number=id text7 id=input4
title=id text8 id=input5
status=id text9 id=input6
price=id text10 id=input7
so I want to pass the product number in field text7 to the enquiry form field input4

I have been following a couple of posts about passing data:
https://www.wix.com/corvid/forum/community-discussion/sending-hidden-dynamic-data-using-onbeforesave

https://www.wix.com/code/home/forum/questions-answers/passing-hidden-data-in-a-form

and this is what I have so far:


 $w.onReady(function () {
 $w("#text8").text; 
 $w("#text7").text; 
 $w("#dataset1").onBeforeSave(() => {
     $w("#dataset1").setFieldValues( {
             "Input5": $w('#text8').text,
             "Input4": $w('#text7').text,   
   } );   
   $w("#dataset1").save();
   });
   });
   

but it still does not work, I am new to wix coding and have only basic knowledge so any help would be much appreciated.

Thanks in advance