sathyapriyan
Returning Observer

Different Default values for Meta Data Form according to different Page Templates

Jump to solution

Hello Everyone,

Is there a possibility to set different default values for Meta Data form according to different page templates? For Eg, If I have a drop down in Meta Data Page template, it is possible to set different values as default for different page template available.

Thank you and Regards,

Sathya

1 Solution

Accepted Solutions
hoebbel
Crownpeak employee

Dear Sathya,

the default value is defined with the template definition, so it cannot be changed dynamically.

To make dynamic changes to the forms, you need a rule. With this rule here you can read the template and save it somewhere

    <RULE when="ONLOCK">

        <WITH>

            <PROPERTY name="TEMPLATE" source="#global"/>

        </WITH>

        <DO>

            <PROPERTY name="VALUE" source="st_Template/>

        </DO>

    </RULE>

But in the metadata it would be the page template of the metadata, which is always the same. So it's a bit more complicated.

Maybe the following will solve your problem:

Define a hidden input component within each page template, which you assign the desired "default value" for the respective pagetemplate. It's important that it's the same input component (COMBOBOX) that should be pre-populated in the metadata (otherwise the value cannot just be copied)

If the value of the page template should always be taken (so it is not a default value, but an automatic defined value), it should be sufficient to use the following rule (adjust the component names):

<RULE>

<SCHEDULE delay="0" id="metadatadropdown" service="FormDataValueService">

<PARAM name="UID">

<PROPERTY name="PAGE_UID" source="#global"/>

</PARAM>

<PARAM name="UIDTYPE">

<TEXT>PAGESTORE</TEXT>

</PARAM>

<PARAM name="FIELD">

<TEXT>st_template_default</TEXT>

</PARAM>

<PARAM name="LANGUAGE">

<TEXT>DE</TEXT>

</PARAM>

</SCHEDULE>

<DO>

<PROPERTY name="VALUE" source="md_myCombobox"/>

</DO>

</RULE>

More Information about the FormDataValueService can be found here:

FirstSpirit Online Documentation - Accessing information from other forms

But if it is really a default value, then you need another hidden input component, this time in the metadata. The value from the page template must then be transferred to this component (via the above rule) and adopted as the default value in the final target component with a second rule, which is only executed if the target input component is empty.

I hope this will help you to solve the problem.

Best regards

Holger

View solution in original post

2 Replies
hoebbel
Crownpeak employee

Dear Sathya,

the default value is defined with the template definition, so it cannot be changed dynamically.

To make dynamic changes to the forms, you need a rule. With this rule here you can read the template and save it somewhere

    <RULE when="ONLOCK">

        <WITH>

            <PROPERTY name="TEMPLATE" source="#global"/>

        </WITH>

        <DO>

            <PROPERTY name="VALUE" source="st_Template/>

        </DO>

    </RULE>

But in the metadata it would be the page template of the metadata, which is always the same. So it's a bit more complicated.

Maybe the following will solve your problem:

Define a hidden input component within each page template, which you assign the desired "default value" for the respective pagetemplate. It's important that it's the same input component (COMBOBOX) that should be pre-populated in the metadata (otherwise the value cannot just be copied)

If the value of the page template should always be taken (so it is not a default value, but an automatic defined value), it should be sufficient to use the following rule (adjust the component names):

<RULE>

<SCHEDULE delay="0" id="metadatadropdown" service="FormDataValueService">

<PARAM name="UID">

<PROPERTY name="PAGE_UID" source="#global"/>

</PARAM>

<PARAM name="UIDTYPE">

<TEXT>PAGESTORE</TEXT>

</PARAM>

<PARAM name="FIELD">

<TEXT>st_template_default</TEXT>

</PARAM>

<PARAM name="LANGUAGE">

<TEXT>DE</TEXT>

</PARAM>

</SCHEDULE>

<DO>

<PROPERTY name="VALUE" source="md_myCombobox"/>

</DO>

</RULE>

More Information about the FormDataValueService can be found here:

FirstSpirit Online Documentation - Accessing information from other forms

But if it is really a default value, then you need another hidden input component, this time in the metadata. The value from the page template must then be transferred to this component (via the above rule) and adopted as the default value in the final target component with a second rule, which is only executed if the target input component is empty.

I hope this will help you to solve the problem.

Best regards

Holger

Hi Holger,

Thanks for the Solution.

Best Regards,

Sathya

0 Kudos