Prefill hidden fields

Please referer to a custom code shared in this thread:
https://premium.wpmudev.org/forums/topic/forminator-fill-in-fields-from-url/#post-3676413

I would like to prefill hidden fields, the code shared in the thread is working well for normal text fields.