Copied to clipboard

Flag this post as spam?

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


  • Selah 7 posts 27 karma points
    Apr 09, 2010 @ 00:37
    Selah
    0

    Manipulating form fields programmatically

    I'm trying to tie several forms, each connected to its own database table, together using a common key. I have access to the key in my workflow, but can't find a good way to get the key written along with the rest of the form fields.

    Here's what I'm doing inside my workflow:

    List<object> l = new List<object>();
    foreach (RecordField f in record.RecordFields.Values)
    {
    if (f.Field.DataSourceFieldKey.ToString() == "keyID")
    {
    l.Add(keyId);
    f.Values = l;
    }
    }

    Umbraco.Forms.Data.Storage.RecordStorage store = new RecordStorage();
    store.UpdateRecord(record, e.Form);
    store.Dispose();

     

    This all seems to work, but when I look in the DB, the value entered in the web field is written, rather than my new value.

    Ideally, I'd like to set this keyId field to a throw-away, default value so the user won't see it (rather, I don't have to hide it via CSS), but in that case it doesn't show up in the list of fields under record.RecordFields.

    Any idea what I'm doing wrong here, or thoughts for a better approach?

  • Tim Geyssens 6562 posts 15373 karma points MVP 2x c-trib
    Apr 09, 2010 @ 14:44
    Tim Geyssens
    0

    Hi Selah,

    Can't you simply use the record id as the common key?

  • Selah 7 posts 27 karma points
    Apr 09, 2010 @ 21:55
    Selah
    0

    I'm using multiple forms, and thus, multiple records need to be linked.

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies