London Dev Meetup Rescheduled! Due to unavoidable reasons, the event has been moved to 21st May. Speakers remain the same—any changes will be communicated. Seats are limited—register here to secure your spot!
AI OnAI Off
London Dev Meetup Rescheduled! Due to unavoidable reasons, the event has been moved to 21st May. Speakers remain the same—any changes will be communicated. Seats are limited—register here to secure your spot!
Hi!
Try attaching to the BeforeSubmittingPostedData event for your XFormControl instance and set your file upload values direcly to the e.FormData object in your event arguments. Here´s a sample from the sdk:
e.FormData.SetValue("mycustomvalue", "12345");
Regards
Linus Ekström
EPiServer Development Team
Thanks Linus!
I saw this in the SDK:
XForm form = new XForm();
XFormData data = form.CreateFormData();
NameValueCollection values = data.GetValues();
foreach(String key in values)
{
data.SetValue(key, "abc");
}
data.ChannelOptions = ChannelOptions.Database;
data.Send(); // In 4.51 you have to call data.Send(data.FormId);
But I didn't see anything about e.FormData.SetValue. I couldn't figure out how to add to the same form instead of a new form created.
I created a custom page type that is a mix of using a regular xform created in Edit mode, and I have added a custom file upload tool at the top of the page. I added a custom button submit, and on submit it stores the xform data using:
FormControl.SubmitForm(ChannelOptions.Database);
I've stored the file names uploaded into an array. How do I also add these files names (not actual files, just names) into the database? I'm not sure how I append to the database fields stored using ChannelOptions.