Populating a hidden field in a HubSpot form with Javascript

Hi @KKoch0

here is the code that works fine for me.

hbspt.forms.create({
 region: "na1",
 portalId: "xxxxxx",
 formId: "xxxxxx",
 onFormReady: function($form) {
 // Wait until the form is fully rendered and fields are accessible
 setTimeout(function() {
 const assetField = $form.find('input[name="asset_requested"]');
 if (assetField.length) {
 //do your codinng here
 }
 }, 500); // Adjust timeout as needed for your form loading speed
 }
});

I hope this will help you out. Please mark it as Solution Accepted and upvote to help another Community member.
Thanks!