How to reference a field from another field in the content tree
Hi. This must have been asked before but I can't find a post.
I'm trying to find a way to reference a field from another field from the node properties in the content tree. So for example the DocType property pageText includes the value of the contactName property (of the same DocType). Something like this:
"Call us on [#businessPhone] or [#contactCellPhone]".
This doesn't work, and I could probably use a macro, but hoping for a Umbraco Library function I could use?
Hi Bijesh. Thanks for your reply. Sorry if I wasn't clear. I'll have another go at explaining it.
I'm trying to reference a field value from the same node (so not recursive) - this is no problem in a template or a macro, of course. In this instance though I'm looking for a way to do it from the content tree so that when I open say, the Home page, and edit a field 'Page Text' in the textbox, I can reference another field to get a phone number from 'Phone Number' field from within the text box itself, and have it display in the page text - so it's totally about top level content editing.
I see that on the tinyMCE toolbar there's an option to call a macro and I could write a generic macro to retreive the values, but just wondered if there was some shorthand functionality (such as bracket syntax, above) that allows me to do this without calling a macro, since it seems long winded, and, being new to Umbraco, I want to ensure I'm doing things in the best/simplest way.
As far as I know, you cannot reference another field when editing a field in the content area. This is either done in the template using bracket syntax or as you mentioned using a macro.
How to reference a field from another field in the content tree
Hi. This must have been asked before but I can't find a post.
I'm trying to find a way to reference a field from another field from the node properties in the content tree. So for example the DocType property pageText includes the value of the contactName property (of the same DocType). Something like this:
"Call us on [#businessPhone] or [#contactCellPhone]".
This doesn't work, and I could probably use a macro, but hoping for a Umbraco Library function I could use?
Thanks
Richard
Sounds like you're trying to do a recursive call if i'm not mistaken. Maybe 1 of these posts has what you're looking for?
http://our.umbraco.org/forum/using/ui-questions/8397-Equivalent-to-recursive-on-macros
http://our.umbraco.org/forum/developers/xslt/11470-Recursive-macro-for-a-banner
Hi Bijesh. Thanks for your reply. Sorry if I wasn't clear. I'll have another go at explaining it.
I'm trying to reference a field value from the same node (so not recursive) - this is no problem in a template or a macro, of course. In this instance though I'm looking for a way to do it from the content tree so that when I open say, the Home page, and edit a field 'Page Text' in the textbox, I can reference another field to get a phone number from 'Phone Number' field from within the text box itself, and have it display in the page text - so it's totally about top level content editing.
I see that on the tinyMCE toolbar there's an option to call a macro and I could write a generic macro to retreive the values, but just wondered if there was some shorthand functionality (such as bracket syntax, above) that allows me to do this without calling a macro, since it seems long winded, and, being new to Umbraco, I want to ensure I'm doing things in the best/simplest way.
Thanks again
Richard
Hi Richard
As far as I know, you cannot reference another field when editing a field in the content area. This is either done in the template using bracket syntax or as you mentioned using a macro.
Thanks Bijesh, good to know. Looks like macro's the way. It would be a nice feature though...
Cheers
Richard
is working on a reply...
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.