I'm trying to write the Dreamweaver TBB and I am stuck at one point where I need to get the field value at a different template level.
Below is my XML where I need to get the inputType field present at formField level to the input Templating level.
<formField>
<divClassName>fieldClassName</divClassName>
<label>Please enter your Name</label>
<labelId>labelNameId</labelId>
<inputType>text</inputType>
<input>
<inputName>sam</inputName>
<inputId>ssss</inputId>
<inputSize>40</inputSize>
<inputLabel>xxx</inputLabel>
<inputValue>zzz</inputValue>
</input>
<input>
<inputName>gf</inputName>
<inputId>g</inputId>
<inputSize>fdg</inputSize>
<inputLabel>sg</inputLabel>
<inputValue>gsdfg</inputValue>
</input>
<param1>ssss</param1>
<param2>ssss</param2>
</formField>
To get the value in the same level we can use
<!-- TemplateBeginRepeat name="Component.Fields.formField" -->
@@inputType@@
<!-- TemplateEndRepeat -->
But my requirement is to get the inputValue at input templating level
<!-- TemplateBeginRepeat name="input" -->
@@inputType@@
<!-- TemplateEndRepeat -->
This code fails to return as there is no inputType present at input templating level. So i tried to use:
<!-- TemplateBeginRepeat name="input" -->
@@RenderComponentField("formField[0].inputType",0)@@
<!-- TemplateEndRepeat -->
Here there are two issues when i use RenderComponentField the output looks like:
<tcdl:ComponentField name="formField[0].inputType" index="0">
text
</tcdl:ComponentField>
its returning the value along with tcdl tags which I don't require.
Secondly, instead of the index directly giving 0 , I need to use TemplateRepeatIndex
, but its giving an error if i use @@RenderComponentField("formField[TemplateRepeatIndex].inputType",0)@@
So how can we achieve this if we want to get the field value at a different templating level.
Your question is a little confusing, but it seems like you have 2 issues
<tcdl:ComponentField/>
tag which you don't wantTemplateRepeatIndex
If that is not correct, please consider modifying your question.
For issue number #1- can I assume you are seeing the <tcdl:ComponentField/>
in Template Builder? Or are you seeing this in the final published page? This tag is added to the output by the @@RenderComponentField@@
function to allow you to add SiteEdit of TridionUI markup to your output. If should not end up in your published pages if you apply the 'Default Finish Actions' TBB at the end of your template. The default templates contain code to clean up this tags after any SiteEdit/UI markup is applied.
For your second issue, take a look at these post 'How to handle nested repeating regions in Dreamweaver TBBs in SDL Tridion 2011 SP1' and 'http://www.tridiondeveloper.com/get-and-set-variables-in-dwts'.
Nested/embeded fields can be confusing using the default Tridion syntax for Dreamweaver, so you might consider using the great GetExtension from Nuno Linhares. This will make your life much easier