Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Tridion UI Editing Blank/Non-Template Fields

I am trying to design a component template that will enable an author to perform inline editing on all fields that are part of the associated schema. This would be straightforward if the template in question displayed all of the fields from the associated schema.

Probably best I explain myself with an example. The website has a news section and, for the sake of this example, let us say the news article schema has a headline, summary, body and date. I would like the user to be able to edit all of these fields in one place via Tridion UI and the most sensible place for this editing to happen seems to be within the news detail template. Problem is, the news detail template needs to display the headline, date and the body but shouldn't display the summary. I would therefore like the user to be able to see/edit the summary field when editing the component but not display the summary on the template any other time.

I see from the Tridion UI documentation that it is possible to enable inline editing of blank/non-template fields as follows:

<tcdl:ComponentField name="Summary"></tcdl:ComponentField>

This works ok in that nothing is displayed until the user starts editing the component at which point the value "add text" is displayed in place of the code above. Functionally this is fine as it achieves what I require. The problem I have is it isn't that user friendly as there is no label to describe to the user what it is they are actually editing. The problem obviously isn't that bad in the example above but in reality there are more non-template fields similar to summary that I want the user to be able to edit on the news detail page e.g.

<tcdl:ComponentField name="Summary"></tcdl:ComponentField>
<tcdl:ComponentField name="AnotherField1"></tcdl:ComponentField>
<tcdl:ComponentField name="AnotherField2"></tcdl:ComponentField>

This causes the following when the user starts editing the component:

<add text>
<add text>
<add text>

I have tried inserting specific rendering code within the tcdl:ComponentField tag but this layout then permanently gets displayed on the staging site e.g.:

<tcdl:ComponentField name="Summary">Summary: @Fields.Summary</tcdl:ComponentField> 

I am wondering whether it is therefore possible to override the "add text" placeholder content so it would display something similar to the following when editing the component:

<Enter Summary>
<Enter Additional Field 1>
<Enter Additional Field 2>

Or is there a better/easier way of implementing what I am trying to achieve?

Thanks

Phil

like image 842
user1505016 Avatar asked Aug 21 '12 08:08

user1505016


1 Answers

It is not possible to easily overwrite the "add text" label. But you can just output the label you want before the tcdl:ComponentField tag.

For example:

<div>Summary: <tcdl:ComponentField name="Summary"></tcdl:ComponentField></div>
like image 147
Peter Kjaer Avatar answered Sep 18 '22 22:09

Peter Kjaer