Skip to main content

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

Comments

2 comments

  • Zendesk API User
    Author: hoebbel - 6/10/2021 14:42

    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

    0
  • Zendesk API User
    Author: sathyapriyan - 6/25/2021 9:14

    Hi Holger,

    Thanks for the Solution.

    Best Regards,

    Sathya

    0

Please sign in to leave a comment.