Copied to clipboard

Flag this post as spam?

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


  • Christian Stenfors 80 posts 124 karma points
    Feb 19, 2013 @ 11:27
    Christian Stenfors
    0

    having a summary/confirm page at the end of the form?

    I would like to have a kind of summary page after a user has filled out the contour formular so they can see what they typed in, and confirm the inputted data.

    I just don't know how best (how at all) to code/create that feature. Can anybody help me out? Maybe point me to the right tools... could i do it by using workflows, and how? or should/could it be done by code?

    Any help is alot of help :-)

    Regards,

    Christian

  • Comment author was deleted

    Feb 19, 2013 @ 12:58

    Maybe a custom fieldtype that you then place on the second step..

  • Christian Stenfors 80 posts 124 karma points
    Feb 19, 2013 @ 13:23
    Christian Stenfors
    0

    yes, that sounds like it could work. Because then you could loop through all fields with data in them, show then to the user and ask the user to approve or to go to previous step and change whatever they need to...

    I will give it a try. Also a good task for me to becoming more familiar with creating custom fieldtypes :)

    Thanks for the input Tim

  • Christian Stenfors 80 posts 124 karma points
    Feb 21, 2013 @ 11:21
    Christian Stenfors
    0

    Now i got the custom fieldtype working. It only displays what have been filled out in prev step, so all is good there.

    But when i test it and go back to a prev step and alter some values, specific, if i set a textbox value to blank, the change does not save.

    Any idea why this happens?

  • Comment author was deleted

    Feb 21, 2013 @ 11:33

    Mind sharing the code?

  • Christian Stenfors 80 posts 124 karma points
    Feb 21, 2013 @ 11:52
    Christian Stenfors
    0

    sure, is there a way to format the code a bit when you submit it? (in the forum editor i mean)

    Just so that it don't fill 2 screenheights :)

  • Christian Stenfors 80 posts 124 karma points
    Feb 21, 2013 @ 11:59
    Christian Stenfors
    0

    using

     

     

    System;

     

    using

    System.Collections.Generic;

     

    using

    System.Linq;

     

    using

    System.Text;

     

    using

    System.Threading.Tasks;

     

    using

    System.Web;

     

    using

    System.Web.UI.WebControls;

     

    using

    System.Xml.XPath;

     

    using

    Umbraco.Forms.Core;

     

    using

    Umbraco.Forms.Data.Storage;

     

    namespace

    Stenfors.Contour.FieldTypes

     

    {

     

    publicclassOrderSummary : Umbraco.Forms.Core.FieldType

     

    {

     

    [Umbraco.Forms.Core.Attributes.Setting(

    "Intro tekst", description = "En tekst som bliver vist før opsummeringen", control = "Umbraco.Forms.Core.FieldSetting.TextField")]

     

    publicstring IntroText { get; set; }

     

    public System.Web.UI.WebControls.Label lb;

     

    publicList<Object> _value;

     

    public OrderSummary()

     

    {

     

    //Provider

     

    this.Name = "Opsummering af bestilling";

     

    this.Id = newGuid("D6A2C406-CF89-11DE-B075-55B055D89593");

     

    this.Description = "Dette vil vise en opsummering af det som er blevet bestilt";

     

    //FieldType

     

    this.Icon = "label.png";

     

    this.DataType = FieldDataType.String;

     

    lb =

    new Label();

     

    _value =

    newList<object>();

     

    }

     

    publicoverride WebControl Editor

     

    {

     

    get

     

    {

     

    WebControl wc =

    new WebControl(System.Web.UI.HtmlTextWriterTag.Div);

     

    Literal lt =

    new Literal();

     

    try

     

    {

     

    lt.Text =

    "<h2>Bekræft din bestilling</h2>";

     

    Umbraco.Forms.Data.Storage.FormStorage fStorage =

    new Umbraco.Forms.Data.Storage.FormStorage();

     

    Form form = fStorage.GetForm(

    "ordSum");

     

    string cookieStuff = Umbraco.Forms.Core.Services.RecordService.GetCookieReference(form);

     

    string cookie = umbraco.library.RequestCookies(cookieStuff);

     

    RecordStorage rs =

    new RecordStorage();

     

    Guid g = newGuid(cookie);

     

    Record r = rs.GetRecord(g);

     

    foreach (Guid fieldId in r.RecordFields.Keys)

     

    {

     

    RecordField rf = r.RecordFields[fieldId];

     

    if (rf.HasValue())

     

    {

     

    Field field = rf.Field;

     

    FieldSet fieldSet =

    new FieldSetStorage().GetFieldSet(field.FieldSet);

     

    lt.Text +=

    "<p>" + fieldSet.Caption + ", " + field.Caption + " = " + rf.ValuesAsString() + "</p>";

     

    }

     

    }

     

    }

     

    catch (Exception ex)

     

    {

     

    lt.Text =

    "<p>log ID : " + _logger + ", grapper: " + _grapper + ", besked: " + ex.Message + "</p>";

     

    }

     

    wc.Controls.Add(lt);

     

    return wc;

     

    }

     

    set

     

    {

     

    base.Editor = value;

     

    }

     

    }

     

    publicoverridebool HideLabel

     

    {

     

    get

     

    {

     

    returntrue;// base.HideLabel;

     

    }

     

    set

     

    {

     

    base.HideLabel = value;

     

    }

     

    }

     

    publicoverrideList<object> Values

     

    {

     

    get

     

    {

     

    return _value;

     

    }

     

    set

     

    {

     

    _value =

    value;

     

    }

     

    }

     

    publicoverridestring RenderPreview()

     

    {

     

    return"label tekst";

     

    }

     

    publicoverridestring RenderPreviewWithPrevalues(List<object> prevalues)

     

    {

     

    return RenderPreview();

     

    }

     

    }

     

    }

     

  • Comment author was deleted

    Feb 21, 2013 @ 12:51

    Ok thanks I'll take a look and report back :)

  • Christian Stenfors 80 posts 124 karma points
    Feb 21, 2013 @ 12:53
    Christian Stenfors
    0

    cool. Thank you for helping.

    What i don't understand is why this problem happens to the normal fieldtypes.

  • Christian Stenfors 80 posts 124 karma points
    Feb 21, 2013 @ 12:54
    Christian Stenfors
    0

    Umbraco CMS version = 4.7.1

    Contour version = 1.1.11

  • Comment author was deleted

    Feb 21, 2013 @ 13:03

    Looks like it's a bug in Contour, it doesn't clear the value , checking a fix now

  • Comment author was deleted

    Feb 21, 2013 @ 13:04

    Works ok with razor render so it's the webcontrols

  • Comment author was deleted

    Feb 21, 2013 @ 13:15

    Fixed will be part of 3.0.8 http://issues.umbraco.org/issue/CON-272

    What version are you currently using that I can see if it's possible to provide a patch for you install

  • Comment author was deleted

    Feb 21, 2013 @ 13:17

    Nevermind so you are using Contour version = 1.1.11 :) will see if I can provide you with a patch

  • Comment author was deleted

    Feb 21, 2013 @ 13:23

    Ok should work gimme 15 mins :) 

    Like you said it's happening with the default fieldtypes so nothing wrong with your code!

  • Christian Stenfors 80 posts 124 karma points
    Feb 21, 2013 @ 13:24
    Christian Stenfors
    0

    Would be so cool if you could help me out with some sort of patch for this :)

  • Comment author was deleted

    Feb 21, 2013 @ 13:28

    Try this: https://dl.dropbox.com/u/886345/PatchForChristian.zip

    Unzip and place in the bin directory overwriting the existing providers assembly

    Let me know if that does the trick

  • Christian Stenfors 80 posts 124 karma points
    Feb 21, 2013 @ 13:43
    Christian Stenfors
    0

    hephey, my very own patch! Very VIP stuff here :D

    It is allmost perfect. It does in fact update the value so that it is empty. But the RecordField still returns as HasValue. This is a minor thing (in this case), but would of course be nice if that worked to.

    Is that fixable?

  • Comment author was deleted

    Feb 21, 2013 @ 13:46

    Well it has a value, an empty string, so you can also include a check for that (stringnullorempty) would that work ?

  • Christian Stenfors 80 posts 124 karma points
    Feb 21, 2013 @ 14:06
    Christian Stenfors
    0

    yes, in this case that is just fine :)

    thank you for helping me out, your a life-saver!

    I will mark your suggestion for using a custom fieldtype as the answer, and then Hi5 you for the patch.

    Have an awesome day..

  • Christian Stenfors 80 posts 124 karma points
    Feb 21, 2013 @ 15:21
    Christian Stenfors
    0

    You can see the endresult here if you are interested:

    http://janssmoerrebroed.dk/bestilling-af-smoerrebroed.aspx

  • Comment author was deleted

    Feb 21, 2013 @ 16:02

    Nice :)

Please Sign in or register to post replies

Write your reply to:

Draft