4

Created Embedded schema which is multivalue have the fields like style tag which is a keyword and passed the default value as H1 for it and this schema is embedded into another schema.

Created component using the content schema.

    <!-- TemplateBeginRepeat name="PrivacyTermsGroup" -->
            <!-- TemplateBeginIf cond="PrivacyTermsGroup.StyleTag !='' " -->
                @@StyleTag@@
            <!-- TemplateEndIf -->
<!-- TemplateBeginIf cond="PrivacyTermsGroup.StyleTag ='' " -->
                H1
            <!-- TemplateEndIf -->
                @@Title@@
                @@Description@@
    <!-- TemplateEndRepeat -->

In the DWT want to check the condition the embedded field is empty or not. If the field is empty want to push the default value hard coded in the code but doesn't get any value

Please need your inputs

1 Answer 1

3

First of all, the default values on a Schema field, are designed to be set when you first create/save a Component. So this value will either be set on the field, and if that wasn't the case, it won't really be used or exposed otherwise anymore.

Secondly, a DWT TBB gives you rather minimal options in accessing data, what is exposed is only what seemed absolutely necessary. This means you will only have access to the Components content through its fields, but not every detail of its Schema. To compensate for the perceived limitations of the "out-of-the-box" Dreamweaver Mediator, the Dreamweaver Get eXtension (DGX) has been built.

Now while this itself won't solve your issues either (since it doesn't expose the default value of a Schema which you are looking for), it is a good source of information on how you could solve your issue. Take a look at the source code for the DGX, and see how easy it is to build a custom Function Source for your DWT TBBs. You would have to code a function along the lines of GetDefaultValue(String Fieldname).

Another option (if you don't like the Function Source solution for whatever reason), will be to create a C# TBB and push the default values in the package. As long as you place this TBB in front of your DWT TBB, you will have access to all these values.

1
  • Thnaks Bart.. I have applied the styletag to the title using <@@Styletag@@>@@title@@</@@styletag@@> it worked for me
    – k951
    Commented Jan 29, 2015 at 7:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.