... still trying to figure out what's causing this error in Umbraco Forms. Looking in the logs, it is throwing an error of "An item with the same key has already been added."
I've seen a few threads here where a similar issue has popped up elsewhere in Umbraco, but this seems to be specific to pulling member info into forms. I've tried:
using other, most definitely not repeated, member properties
embedding the form on pages that don't pull in member data, or have
permissions set
stripping down the form and workflow
... but no go. Maybe all of the member data is being pulled in another way, but I'm not sure how to find the conflict.
I couldn't figure out where the member data was in conflict, or if it was a bug (or related to analytics) ... so I did the javascript workaround. For the possible benefit of other 'implementors' trying to figure this out, this is how it worked -- I have no doubt this could be handled better, if anyone wants to add any comments.
in the template, call in your member info
@inherits Umbraco.Web.Mvc.UmbracoTemplatePage<ContentModels.Article>
@using ContentModels = Umbraco.Web.PublishedContentModels;
@using Umbraco.Web.Models;
@using Umbraco.Web.Security;
@{
Layout = "Master.cshtml";
var loginStatusModel = Members.GetCurrentLoginStatus();
var membershipHelper = new MembershipHelper(UmbracoContext.Current);
var currentUser = Membership.GetUser();
var currentMember = currentUser != null ? membershipHelper.GetById((int) currentUser.ProviderUserKey) : null;
}
I wanted to create a share link that would pop the form in a modal, ask the member for the email, then send a link to the article with an excerpt, and a note of "member name has shared an article ..."
var currentFirstName = currentMember.GetPropertyValue("firstName");
var currentLastName = currentMember.GetPropertyValue("lastName");
var contentSnippet = Umbraco.Truncate(library.StripHtml(Model.Content.GetPropertyValue<string>("articleContent")), 250, true);
var currentMemberName = (currentFirstName + " " + currentLastName);
<input id='membernameorigin' name='member-name' type='hidden' value='@currentMemberName'>
<input id='snippetorigin' name='member-snippet' type='hidden' value='@contentSnippet'>
{ Html.RenderPartial("SiteLayout/_articleshare"); }
then move the values into the Umbraco form fields
<script>
var membernameorigin = $('#membernameorigin');
var membernamecopy = $('#03450430-3433-89ef-bab2-fb30b46ee564');
var snippetorigin = $('#snippetorigin');
var snippetcopy = $('#e26d32c9-2183-4c34-cc66-6545hbe87dc45');
membernamecopy.val(membernameorigin.val());
snippetcopy.val(snippetorigin.val());
</script>
note, if you are using bootstrap modals in partial, you might need to move it down the dom
'membernamecopy' passes a value to a hidden field (in Umbraco Forms back office) with the alias "memberSendName", so you can then pass that value into a workflow using a 'magic string', e.g. add to the subject line:
{memberSendName} has shared an article with you
if you are using the form in a modal, the submission needs to be done via ajax, or your modal just closes, and is replaced with your 'thank you' message when reopened again on the same page.
Umbraco Forms: Error when using member data
Hello,
I'm trying to pull member properties into an Umbraco Form field, but it's throwing an error that keeps the form from rendering.
The member property:
used as a prevalue in a hidden field:
The error:
It seems to be a similar issue to this thread, but it looks like it was fixed:
https://our.umbraco.com/forum/umbraco-forms/80165-use-member-data-in-forms
Does anyone have an idea what would cause this or a fix?
thank you
... still trying to figure out what's causing this error in Umbraco Forms. Looking in the logs, it is throwing an error of "An item with the same key has already been added."
I've seen a few threads here where a similar issue has popped up elsewhere in Umbraco, but this seems to be specific to pulling member info into forms. I've tried:
permissions set
... but no go. Maybe all of the member data is being pulled in another way, but I'm not sure how to find the conflict.
thanks
I couldn't figure out where the member data was in conflict, or if it was a bug (or related to analytics) ... so I did the javascript workaround. For the possible benefit of other 'implementors' trying to figure this out, this is how it worked -- I have no doubt this could be handled better, if anyone wants to add any comments.
in the template, call in your member info
I wanted to create a share link that would pop the form in a modal, ask the member for the email, then send a link to the article with an excerpt, and a note of "member name has shared an article ..."
then move the values into the Umbraco form fields
note, if you are using bootstrap modals in partial, you might need to move it down the dom
'membernamecopy' passes a value to a hidden field (in Umbraco Forms back office) with the alias "memberSendName", so you can then pass that value into a workflow using a 'magic string', e.g. add to the subject line:
if you are using the form in a modal, the submission needs to be done via ajax, or your modal just closes, and is replaced with your 'thank you' message when reopened again on the same page.
is working on a reply...