If you’re using WordPress for your forms you can use this handy plugin:
(You won’t be able to use Javascript on forms hosted by AC).
One point, though. Your fields will always feature the latest campaign info, and not keep a history… if a user reachers your site via multiple campaigns. There is no way to only retain the first set of data populating the fields either.
An alternative, and you’ll have to Google the instructions for this, is to have the UTM values captured as events.
You just need to put the form (either through the small piece of script or the full form html) on a page and it will automatically insert the URL parameters in the hidden fields IF you name those parameters exactly the same as your form fields like you mentioned in your example. Note that this only works if you have a landing page where leads immediately sign up, if they browse on other pages so that the URL parameters disappear you won’t have the data filled automatically anymore.
You can go around that by storing those utm parameters in a cookie and putting some javascript in place to grab the values from the cookie and put it in your hidden fields. There are a lot of good tutorials to do that, e.g. https://jennamolby.com/how-to-use-cookies-to-capture-url-parameters/