Craig100
01/17/2025, 8:42 AM@Html.RenderUmbracoFormDependencies(Url)
@if (Model.FormPicker.HasValue) {
@await Component.InvokeAsync("RenderForm", new { formId = @Model.FormPicker.Value, theme = "MyTheme", includeScripts = true })
}
I've tried and failed with various options with "prepopulatedData" as suggested by ChatGPT but they were a waste of time, including using a ViewComponent and partial. I don't particularly want to create a special workflow for every form, I was hoping someone could suggest how to do it with magic strings in the form set up. Tried getting the Member email into a hidden field but one issue is getting it to appear before the form is sent for rendering.
Any suggestions would be greatly appreciated.
Thanks.Ravi
01/17/2025, 8:48 AMMike Chambers
01/17/2025, 9:23 AMMember properties from a form submission
{member.FOO} with the prefix of member, the same syntax will allow you to retrieve information about the submission if it was submitted by a logged-in member.
Mike Chambers
01/17/2025, 9:25 AMMike Chambers
01/17/2025, 9:34 AMcsharp
@*Not sure why we have to do this, but the page Model isn't correcty rehydrated*@
ViewData.ModelState.TryGetValue("CallToDiscuss", out var callToDiscuss);
ViewData.ModelState.TryGetValue("CallBackConsent", out var callBackConsent);
ViewData.ModelState.TryGetValue("LocationPreferences", out var locationPreference);
string showCallOptions = bool.Parse(callToDiscuss?.AttemptedValue ?? "False") ? "" : " visually-hidden";
string showAllForm = ( callBackConsent?.AttemptedValue?.Split(",")?.Contains("true") ?? false ) ? "" : " visually-hidden";
var locationPreferences = locationPreference?.AttemptedValue?.Split(",");
Craig100
01/17/2025, 9:45 AM