Iam trying to get field names for submission data in episerver forms submit events. I need to alter the value of a specified field in code that i have generated on every created form each time i submit a form before it is saved into the episerver database.
Any help or tips is much appriciated on how to best tackle this issue.
Best regards Jonas.C
Generally the convention is "__field__" + the id of the block that represents the field name.
You can use the GetDataFriendlyNameInfos method on the FormDataRepository to get this information.
A FriendlyNameInfo have a ElementId that would be the "__field__#", FriendlyName and the Label.
Look at my GitHub to see how it can be used: https://github.com/alfnilsson/EpiserverForms/blob/master/Toders.Forms.Web/Business/Forms/FormReader.cs
For each field you want to display, use
FriendlyNameInfos.First(x => x.ElementId == currentfield.Key).FriendlyName
(or .Label if you prefer).
Note: that the FriendlyNameInfo class is in the namespace internal so Episerver might change this in a future version without it being a major version even if it is a breaking change!