将 XSD 选择元素表示为 LiveCycle Designer PDF 表单

发布于 2024-10-05 13:28:44 字数 1236 浏览 3 评论 0原文

我正在使用 Adob​​e Livecycle Designer 和 XML 文件为项目创建一些 PDF 表单。我创建了一个 XSD,其中包含无限的选择序列,例如如下所示:

<xs:sequence maxOccurs="unbounded">
  <xs:choice>
    <xs:element name="Item1" type="xs:string" />
    <xs:element name="Item2" type="xs:string"/>
  </xs:choice>
</xs:sequence>

为了在 Adob​​e Livecycle Designer 中表示这一点,我有如下所示的内容:

MyForm (Subform)
  ItemsSubForm (Subform, repeated for many items)
    Item1Wrapper (Subform)
      Item1 (TextField)
    Item2Wrapper (Subform)
      Item2 (TextField)
  AddItemsButtonsSubForm
    AddItem1Button (Button)
    AddItem2Button (Button)

当有人按 AddItem1Button 时,我创建一个新的 ItemsSubForm 实例使用以下内容:

this.parent.parent._ItemsSubForm.addInstance();
xfa.resolveNode("this.parent.parent.ItemsSubForm[" +(this.parent.parent.ItemsSubForm.instanceManager.count - 1) + "]").Item2Wrapper.presence = "hidden";

对于 AddItem2Button 则相反。

问题是,除了手动插入项目之外,我还希望能够使用 XML 文件,因此我创建了上面的 XSD。我还使用绑定将 XSD 中的 Item1 和 Item2 元素分别与 Item1Wrapper 和 Item2Wrapper 相关联。问题是,一旦我在 XML 中有 Item1 元素,Item1Wrapper 和 Item2Wrapper 都会被创建(与 Item2 相同)。有什么方法可以控制加载以隐藏相应的包装器?

我想通知您,遗憾的是我无法更改 PDFForm 或 XSD。

I'm using Adobe Livecycle Designer and XML files to create some PDF forms for a project. I created an XSD, which among others contains an unbounded sequence of choices, for example something like the following:

<xs:sequence maxOccurs="unbounded">
  <xs:choice>
    <xs:element name="Item1" type="xs:string" />
    <xs:element name="Item2" type="xs:string"/>
  </xs:choice>
</xs:sequence>

To represent this in Adobe Livecycle Designer, I'm having something like the following:

MyForm (Subform)
  ItemsSubForm (Subform, repeated for many items)
    Item1Wrapper (Subform)
      Item1 (TextField)
    Item2Wrapper (Subform)
      Item2 (TextField)
  AddItemsButtonsSubForm
    AddItem1Button (Button)
    AddItem2Button (Button)

When someone presses AddItem1Button, I create a new ItemsSubForm instance using the following:

this.parent.parent._ItemsSubForm.addInstance();
xfa.resolveNode("this.parent.parent.ItemsSubForm[" +(this.parent.parent.ItemsSubForm.instanceManager.count - 1) + "]").Item2Wrapper.presence = "hidden";

And the opposite thing for AddItem2Button.

The problem is that apart from inserting items manually, I also want to be able to use an XML file, and for that reason I created the XSD above. I also use bindings to associate Item1 and Item2 elements from the XSD with Item1Wrapper and Item2Wrapper respectively. The problem is that once I have an Item1 element in the XML, both Item1Wrapper and Item2Wrapper are created (and the same with Item2). Is there any way to control the loading in order to hide the respective wrapper?

I would like to inform you that unfortunately I cannot change either the PDFForm or the XSD.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

悟红尘 2024-10-12 13:28:44

如果我理解正确的话,解决方案必须仅限于更改 XML 文件。

我认为您无法在不更改 PDF 表单的情况下解决此问题,因为您将其设置为始终插入 ItemsSubForm 的两个子项。

您应该使用与每个 Item?Wrapper 关联的选择子表单或重复设置(对每个数据项重复,最小计数 = 0)。

If I understand you correctly, the solution has to be limited to changing the XML file.

I don't think you'll be able to solve this without changing the PDF form, as you set it up to ALWAYS insert BOTH children of ItemsSubForm.

You should've used either a choice subform or repeat settings associated with each Item?Wrapper (repeat for each data item, Min Count = 0).

多像笑话 2024-10-12 13:28:44

如果选择确实相​​当简单,您可以使用 xsd:enumeration。否则,您的复杂类型应如下所示:

<xs:complexType name="ItemList">
    <xs:sequence>
       <xs:element name="item" type="xs:string" maxOccurs="unbounded"/>
    </xs:sequence>
</xs:complexType>
<xs:element name="myItems" type="ItemList"/>

并且“List Items”动态属性对话框中的绑定应假设

Items:   $record.myItems.item[*]
Item Text:   $
Item Value:  $

您将 myItems 元素放置在架构中的根元素下方。

If the choices really are fairly simple you could use an xsd:enumeration. Otherwise your complex type should look like this:

<xs:complexType name="ItemList">
    <xs:sequence>
       <xs:element name="item" type="xs:string" maxOccurs="unbounded"/>
    </xs:sequence>
</xs:complexType>
<xs:element name="myItems" type="ItemList"/>

and your bindings in the 'List Items' dynamic properties dialog should be

Items:   $record.myItems.item[*]
Item Text:   $
Item Value:  $

assuming that you put the myItems element just under the root element in you schema.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文