Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Madura Silva 27 posts 79 karma points
    Jul 22, 2013 @ 01:13
    Madura Silva
    0

    Partially Submit a form using a Usercontrol

    I'm trying to partiallysubmit a multi step form with following code. But it does not save current step details, saves only upto the last step. Any help for this please.

    CMS Version: 4.8

    Contour version: 1.1.12

    FormStorage formStorage = new FormStorage();
                //local code
                Form form = formStorage.GetForm(new Guid("d7aca7dc-6f51-48df-85c3-da41dcfc4366"));
                RecordService recordService = new RecordService(form);
                recordService.Open();
                var cookieName = RecordService.GetCookieReference(form);
                HttpCookie myCookie = HttpContext.Current.Request.Cookies[cookieName];
                if (myCookie != null)
                {
                    var ss = myCookie.Value;
                    var record = recordStorage.GetRecord(new Guid(ss));
                    recordService.SaveFormToRecord();
                    recordService.NextPage();
                    recordStorage.UpdateRecord(record, form);
                    recordStorage.UpdateRecordXml(record, form);
                    recordService.SaveFormToRecord();
                    recordStorage.Dispose();
                    recordService.Dispose();
                    umbraco.library.RefreshContent();
    }
  • Comment author was deleted

    Jul 31, 2013 @ 13:12

    Hey,

    Looks like you aren't setting any record field values so will only store an empty record..

  • Madura Silva 27 posts 79 karma points
    Aug 01, 2013 @ 00:50
    Madura Silva
    0

    Thank you Tim,

     

    I thought following lines will automatically set values to the record. Do I need to set them manually?

    Could you please post a code sample if you have

    recordService.SaveFormToRecord();
    recordStorage.UpdateRecord(record, form);

    I tried this but it didnt save value.

    record.GetRecordField("TestFiles").Values.Add("Test Field Value");
  • Comment author was deleted

    Aug 01, 2013 @ 10:21
  • Madura Silva 27 posts 79 karma points
    Aug 08, 2013 @ 02:05
    Madura Silva
    0

    Thank you for the sample code Tim,

    Unfortunately it did not work for me because  HttpContext.Current.Request[field.Caption] ?? ""; returns empty string all the time.

    I could complete my task if I know the code they use for 'Next' button in multi step form.

     

Please Sign in or register to post replies

Write your reply to:

Draft