Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] PageId argument not set when adding a new Metadata field #771

Open
burningice2866 opened this issue May 7, 2021 · 0 comments
Open
Labels

Comments

@burningice2866
Copy link
Contributor

Consider this TypeForm for a page metadata where we fill a dropdown based on the page the metadata instance is on

<cms:formdefinition xmlns:cms="http://www.composite.net/ns/management/bindingforms/1.0" xmlns="http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0" xmlns:ff="http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0" xmlns:f="http://www.composite.net/ns/function/1.0">
  <cms:bindings>
    <cms:binding name="PageId" type="System.Guid" />
    <cms:binding name="BuildingId" type="System.Guid" />
  </cms:bindings>
  <cms:layout>
    <cms:layout.label>
      <cms:read source="PageId" />
    </cms:layout.label>

    <FieldGroup Label="Page building profile">
      <KeySelector Label="BuildingId" Help="" OptionsKeyField="Key" OptionsLabelField="Value" Required="true">
        <KeySelector.Selected>
          <cms:bind source="BuildingId" />
        </KeySelector.Selected>

        <KeySelector.Options>
          <ff:StaticMethodCall Type="Schoolwize.C1Console.ConsoleHelpers, Schoolwize.SchoolWebsite" Method="GetBuildingsForWebsite">
            <ff:StaticMethodCall.Parameters>
              <cms:read source="PageId" />
            </ff:StaticMethodCall.Parameters>
          </ff:StaticMethodCall>
        </KeySelector.Options>
      </KeySelector>
    </FieldGroup>
  </cms:layout>
</cms:formdefinition>

Now, while this works fine when editing pages that has the metadata, the PageId argument is empty when adding the metadata field the first time. And since the value is required, we end up in a chicken-and-egg situation where the field can never be added since it require the value to be set. Which we can't since the dropdown selector is empty because PageId is empty.

@napernik napernik added the bug label Oct 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants