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.
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.)
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!
Anyone have a clue about this? I have received no feedback...and I'm still stuck. Thank you for your time!
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?
hey, try this solution....
http://our.umbraco.org/forum/core/general/6496-Doc2Form-Returning-DropDown-IDs-not-Values
Thanks for the post. It's not the key / val thing. That worked for dropdowns from prevalues but not for Nodes.
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:
/Chriztian
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!
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
Thanks. Do you know why it didn't like the "df"?
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:
/Chriztian
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
is working on a reply...