passing value to umbraco form and setting the fields rendring through macro

1.9k views Asked by At

I want to set the form fields like name and email from data though url query string . I have rendered the form through macro . how i can do that my macro rendering code is

@Umbraco.RenderMacro("renderUmbracoForm", new {FormGuid="ccebfbe8-aa28-497e-8078-c3577c88f47a", FormTheme="" ,
 ExcludeScripts="0"} )

My form fields are Name, Email , EventName form pic and url query is

http://localhost:17402/register?eventId=1342&eventName=you%20cant%20save%20the%20world%20alone

1

There are 1 answers

2
DT-UK On

In Umbraco Forms, you can set the Default Value of a field.

enter image description here

For example, set the Default Value to something like [@queryName]. The 'queryName' will be your querystring parameter name in the URL (http://www.website.com/contactus?queryName=Foo) - Umbraco does the rest.

I referred to this and it was pretty straight forward: https://our.umbraco.org/forum/umbraco-pro/contour/14340-Set-value-of-radiobuttonlist-from-querystring