I'm brand new to Umbraco and Umbraco forms and have ran into an issue with prefilling my forms with user information.
Currently all forms are using the same standard FormViewModel and form.cshtml file. We have a service implemented in the solution that allows me to fetch all the information about the user that's currently logged in that i would like to prefill the form with, but i can't see how i can get that information into the form as it is rendered. This would be information like name, email etc.
I found this Adding A Prevalue Source Type To Umbraco Forms documentation but from my understanding this will only create prevalues that can be selected in backoffice and is not dynamically generated as each form is created?
Is there any good code examples out there where i could see how a form comes with dynamically prefilled values as the form is rendered if it is possible?
Thank you in advance, please let me know if anyone would like some more information.
Late update if anyone else runs into this post and is interested.
I solved this by setting some consistent aliases for the fields in Umbraco. Then as the razor view rendered for the next page i read from the form data and updated the prevalue for the fields being rendered with the data.
There's probably better solutions to this, but it works.
Prefilling form with user information
Hi,
I'm brand new to Umbraco and Umbraco forms and have ran into an issue with prefilling my forms with user information.
Currently all forms are using the same standard FormViewModel and form.cshtml file. We have a service implemented in the solution that allows me to fetch all the information about the user that's currently logged in that i would like to prefill the form with, but i can't see how i can get that information into the form as it is rendered. This would be information like name, email etc.
I found this Adding A Prevalue Source Type To Umbraco Forms documentation but from my understanding this will only create prevalues that can be selected in backoffice and is not dynamically generated as each form is created?
Is there any good code examples out there where i could see how a form comes with dynamically prefilled values as the form is rendered if it is possible?
Thank you in advance, please let me know if anyone would like some more information.
I would also like to know if this is possible.
Late update if anyone else runs into this post and is interested.
I solved this by setting some consistent aliases for the fields in Umbraco. Then as the razor view rendered for the next page i read from the form data and updated the prevalue for the fields being rendered with the data. There's probably better solutions to this, but it works.
is working on a reply...