Copied to clipboard

Flag this post as spam?

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


  • singer777 69 posts 80 karma points
    Apr 20, 2012 @ 22:10
    singer777
    0

    Doc2Form e-mails - need to show a node's name

    I have Doc2Form modified to allow users to select from a dropdown menu that is populated by node names, i.e. chocolate, vanilla, etc. Everything works fine.

    When the form is e-mailed, however, I see 1 or 2 instead of chocolate and vanilla. Remember, these are nodes, not typical data types.

    Does anyone know how I can fix this? I have fixed it previously for data types, but I don't know how to do it with nodes.

    I assume it's code to be changed within the doc2form.ascx.cs file.

    Thank you!

     

     

  • singer777 69 posts 80 karma points
    May 18, 2012 @ 05:43
    singer777
    0

    Anyone have a clue about this? I have received no feedback...and I'm still stuck. Thank you for your time!

  • bob baty-barr 1180 posts 1294 karma points MVP
    May 31, 2012 @ 20:37
    bob baty-barr
    0

    i think it has to do with getting the pre-values? can you do a quick search on that and see what you come up with?

  • bob baty-barr 1180 posts 1294 karma points MVP
    May 31, 2012 @ 20:38
  • singer777 69 posts 80 karma points
    May 31, 2012 @ 21:51
    singer777
    0

    Thanks for the post. It's not the key / val thing. That worked for dropdowns from prevalues but not for Nodes.

  • Chriztian Steinmeier 2798 posts 8788 karma points MVP 8x admin c-trib
    May 31, 2012 @ 23:52
    Chriztian Steinmeier
    0

    Hi Jon,

    I did something like this a while ago - I found the file and diff'ed it with th original. In the "Save properties" branch (shortly after line 900), I do this:

    string fieldValue = df.Data.Value.ToString();
    
    // If this is the "kontaktModtager" field, grab the ID and use the fullName property for the value.
    if (d.getProperty(df.DataEditor.Editor.ID).PropertyType.Alias.ToString() == "kontaktModtager") {
        _modtagerID = Int32.Parse(fieldValue);
        fieldValue = new Node(_modtagerID).GetProperty("fullName").Value.ToString();
    }
    
    kontaktModtager is the name of the field (dropdown) that gets its values from nodes in the tree. 
    Note that this requires an additional using statement at the top of the file:
    using umbraco.presentation.nodeFactory;
    (The code uses an awful lot of repeated df.Data.Value.ToString() so I replaced them with fieldValue but that shouldn't be necessary for this to work.)

    /Chriztian 

  • singer777 69 posts 80 karma points
    Jun 08, 2012 @ 22:50
    singer777
    0

    I got this error:

    Compiler Error Message: CS0103: The name 'df' does not exist in the current context
    Keep in mind this site is Umbraco 4.0.2.1.

    Also, I'm not exactly sure where to put the code. I tried it right after the intro for the "Save Properties" area.

    Lastly, when you say kontacktModtager is the dropdown field name - do you mean the property alias or the data type name?

    Thanks again!

  • Chriztian Steinmeier 2798 posts 8788 karma points MVP 8x admin c-trib
    Jun 09, 2012 @ 00:02
    Chriztian Steinmeier
    0

    Hi Jon,

    - kontaktModtager is the property alias

    I've collapsed the code to try and show you where in the structure of the file this is - hope it helps:

    /Chriztian

  • singer777 69 posts 80 karma points
    Jun 09, 2012 @ 00:06
    singer777
    0

    Thanks. Do you know why it didn't like the "df"?

  • Chriztian Steinmeier 2798 posts 8788 karma points MVP 8x admin c-trib
    Jun 09, 2012 @ 00:13
    Chriztian Steinmeier
    0

    No, ws assuming it had a lot to do with the code not being in the right place.

    FWIW in my file it's set like this, around line 389:

    // Properties on current tab
    foreach (umbraco.cms.businesslogic.propertytype.PropertyType pt in t.PropertyTypes)
    {
        umbraco.interfaces.IDataType dt = pt.DataTypeDefinition.DataType;
    
        dt.DataEditor.Editor.ID = pt.Alias;
        _dataFields.Add(dt);
    
        umbraco.interfaces.IData df = pt.DataTypeDefinition.DataType.Data;
    
    ...

    /Chriztian

  • singer777 69 posts 80 karma points
    Jun 12, 2012 @ 00:17
    singer777
    0

    Getting close. I'm now positive I have the code in place. Now the error is:

    Compiler Error Message: CS0103: The name '_modtagerID' does not exist in the current context


Please Sign in or register to post replies

Write your reply to:

Draft