Copied to clipboard

Flag this post as spam?

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


  • Yannick Smits 321 posts 718 karma points
    Dec 18, 2009 @ 12:55
    Yannick Smits
    0

    Using SqlServer Data source

    When using the special "Data Source" option to connect to an existing table how would I insert the record.Ip and record.membername into this table?

  • Yannick Smits 321 posts 718 karma points
    Dec 18, 2009 @ 13:37
    Yannick Smits
    0

    oh and is it possible to have multiple steps when using the Data sources approach?

  • Comment author was deleted

    Dec 23, 2009 @ 11:40

    Hi Yannick, currently it isn't possible to have multiple steps when the form is attached to a Data Source

  • Yannick Smits 321 posts 718 karma points
    Dec 23, 2009 @ 18:17
    Yannick Smits
    0

    Thanks Tim, what about my first question?

  • Yannick Smits 321 posts 718 karma points
    Jan 07, 2010 @ 13:39
    Yannick Smits
    0

    Anyone?

  • kevin 31 posts 52 karma points
    Jan 07, 2010 @ 17:09
    kevin
    0

    I couldn't find it either, as a workaround i created a form in umbraco (this way you can have multiple steps as well) and created a workflow to save the content to an external database, this way you can retrieve the id of the inserted record and add additional logic, you can query record.membername and session/querystring values there as well.
    Let me know if you need some code.

    However, it would be great to be able to add record.Ip and record.membername to the external datasource though :-)

  • Yannick Smits 321 posts 718 karma points
    Jan 07, 2010 @ 23:29
    Yannick Smits
    0

    Hi Kevin, that would help. Can you send it to yannick(a.t)goyaweb.nl? thanks!

  • kevin 31 posts 52 karma points
    Jan 08, 2010 @ 10:44
    kevin
    0

    public

     

    class MyWorkflow : Umbraco.Forms.Core.WorkflowType

    {

     

    public override List<Exception> ValidateSettings()

    {

    List<

    Exception> exceptions = new List<Exception>();

     

    return exceptions;

    }

     

    public MyWorkflow()

    {

     

    this.Name = "My workflow";

     

    this.Id = new Guid("925f95ec-99f1-435a-ae59-89e47bbc6578");

     

    this.Description = "Save entries to custom table";

    }

     

    public override Umbraco.Forms.Core.Enums.WorkflowExecutionStatus Execute(Record record, RecordEventArgs e)

    {

    Umbraco.Forms.Core.Enums.WorkflowExecutionStatus sResult;

    Log.Add(LogTypes.Debug, docId,

    "record submitted with id: " + record.Id

     

     

    // get form field values by guid or caption

    RecordField rfVoornaam = record.RecordFields[new Guid("CA4705F4-CB4C-4DFE-BFD3-018F8AC97FA7")];

    RecordField rfNaam = record.RecordFields[new Guid("4717188E-E0E4-45F5-B332-1C86D59CAA21")];

    RecordField rfEmail = record.RecordFields[new Guid("B1337006-6335-4D97-BFF5-42A4EA76DE74")];

    RecordField rfOptin = record.RecordFields[new Guid("84456225-3C3C-499C-8FBD-55CBE1CF4D6A")];

    RecordField rfVraag = record.RecordFields[new Guid("3D2A2CDB-09FD-410E-BF46-C3E6445044A1")];

    RecordField rfSchift = record.RecordFields[new Guid("DA1B84A3-AE17-46B2-9DF2-FB3E50563043")];

     

     

    // get page to redirect to when user has already filled out the form before

     

    string strFailed = umbraco.presentation.nodeFactory.Node.GetCurrent().GetProperty("Failed").Value.ToString();

     

    int intFailed = Convert.ToInt32(strFailed);

     

     

    //Save

     

    string strFirstName = rfVoornaam.ValuesAsString();

     

    string strLastName = rfNaam.ValuesAsString();

     

    string strEmail = rfEmail.ValuesAsString();

     

    string strLanguage = CultureInfo.CurrentCulture.Name;

     

    string strQuestionAnswer = rfVraag.ValuesAsString();

     

    string strSchiftAnswer = rfSchift.ValuesAsString();

     

     

    Boolean blnOptIn = rfOptin.ValuesAsString() == "True" ? true : false;

     

     

    if (!string.IsNullOrEmpty(strEmail))

    {

     

    // save form data

     

    // result contains 1 (succes) or 0 (failed)

     

    // output param guidNewID with guid to retrieve form data

    Result = SaveEnquete(strLanguage, strFirstName, strLastName, strEmail, blnOptIn, strQuestionAnswer, strSchiftAnswer,

    out guidNewID);

     

     

     

    if (Result >= 0)

    {

     

    // succes!

    sResult = Umbraco.Forms.Core.Enums.WorkflowExecutionStatus.Completed;

     

    // redirect to page specified in umbraco

    }

     

    else

    {

     

    // failed!

    sResult = Umbraco.Forms.Core.Enums.WorkflowExecutionStatus.Failed;

     

    // set redirect to error page!

    e.Form.GoToPageOnSubmit = intFailed;

    }

     

    // save guid to session

    e.Context.Session[

    "form_guid"] = guidNewID.ToString();

     

    return sResult;

    }

    }

    Hope this helps!

  • Yannick Smits 321 posts 718 karma points
    Jan 08, 2010 @ 17:27
    Yannick Smits
    0

    I'm trying to understand the code. Basically you attach this to the "When the form has been submitted" workflow event, right?

    How would you extend this example to support multi-page?

    What do you think is still the advantage of using Contour instead of building your own form?

     

  • kevin 31 posts 52 karma points
    Jan 12, 2010 @ 11:07
    kevin
    0

    Yeah, that's right. It works the same way for multi-page forms, you can retrieve all the fields in the submit stage of the workflow.
    I'm sure this won't be necessary anymore in future versions, for now, once you've figured out how everything works you can still gain lots of time because you only have to take care of saving data : the form can be updated, validation, multi-page is all done by umbraco

  • Yannick Smits 321 posts 718 karma points
    Jan 13, 2010 @ 13:45
    Yannick Smits
    0

    Do you know which method to override when using multi-page? I think Contour also saves partial submits.

Please Sign in or register to post replies

Write your reply to:

Draft