Hello -
I am trying to make a form that repeating subform elements.
See Picture:
I wrapped the repeating elements in a positioned subform, that is then wrapped in subform container (another subform that is set to "flowed" to allow the repetition of the wrapped positioned subform.
The effect looks like this:
(You can see the dynamic repeating parts at the bottom)
Everything works as it should - but I cannot figure out how to bind the data elements to my schema.
If I explicitly bind each data element in the bottom subform directly to a schema element, then if a user fills out one subform, all the other instances prepopulated with the information in the first - so that is no good.
If I explicitly bind the "Containing subform" to my schema (and leave the contained subform as "normal") - then I get unexpected results in the resultant XML.
When I bind the "UserDesigneeContainer" form object, to the element in the same name - here is what the schema looks like:
<?xml version="1.0" encoding="UTF-8" ?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="ProviderAccessSiteRequestSchema">
<xs:complexType>
<xs:sequence>
<!-- Facility / Practice Elements -->
<xs:element name="FacPracNm" type="xs:string" />
<xs:element name="FacPracLn01Ad" type="xs:string" />
<xs:element name="FacPracCityAd" type="xs:string" />
<xs:element name="FacPracStateAd" type="xs:string" />
<xs:element name="FacPracZipAd" type="xs:string" />
<xs:element name="TaxIDNo" type="xs:integer" />
<xs:element name="SiteAdminEmailAd" type="xs:string" />
<xs:element name="SiteAdminNm" type="xs:string" />
<!--Designee Information Subform-->
<xs:element name="UserDesigneeContainer">
<xs:complexType>
<xs:sequence>
<xs:element name="UserDesigneeSubform">
<xs:complexType>
<xs:sequence>
<xs:element name="UserFirstNm" type="xs:string" />
<xs:element name="UserLastNm" type="xs:string" />
<xs:element name="UserAddChangeDelIn">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="Add"/>
<xs:enumeration value="Change"/>
<xs:enumeration value="Delete"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="UserEmailAd" type="xs:string" />
<xs:element name="UserTelNo" type="xs:string" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
The problem with my schema - is that the XML outputs like this (assuming that there are 2 subforms on the page)
<?xml version="1.0" encoding="UTF-8"?>
<xdp:xdp xmlns:xdp="http://ns.adobe.com/xdp/"><xfa:datasets xmlns:xfa="http://www.xfa.org/schema/xfa-data/1.0/">
<xfa:data>
<Form>
<ProviderAccessSiteRequestSchema>
<FacPracNm>Facility Name</FacPracNm>
<FacPracLn01Ad>1234 Facility St</FacPracLn01Ad>
<FacPracCityAd>Businesstown</FacPracCityAd>
<FacPracStateAd>NY</FacPracStateAd>
<FacPracZipAd>12345</FacPracZipAd>
<TaxIDNo>000000000</TaxIDNo>
<SiteAdminEmailAd>test@name.com</SiteAdminEmailAd>
<SiteAdminNm>test name</SiteAdminNm>
<UserDesigneeContainer>
<UserDesigneeSubform>
<UserFirstNm/>
<UserLastNm/>
<UserAddChangeDelIn/>
<UserEmailAd/>
<UserTelNo/>
</UserDesigneeSubform>
</UserDesigneeContainer>
</ProviderAccessSiteRequestSchema>
</Form>
</xfa:data>
<dd:dataDescription xmlns:dd="http://ns.adobe.com/data-description/" dd:name="Form">
<Form>
<ProviderAccessSiteRequestSchema>
<FacPracNm/>
<FacPracLn01Ad/>
<FacPracCityAd/>
<FacPracStateAd/>
<FacPracZipAd/>
<TaxIDNo/>
<SiteAdminEmailAd/>
<SiteAdminNm/>
<UserDesigneeContainer>
<UserDesigneeSubform>
<UserFirstNm/>
<UserLastNm/>
<UserAddChangeDelIn/>
<UserEmailAd/>
<UserTelNo/>
</UserDesigneeSubform>
</UserDesigneeContainer>
</ProviderAccessSiteRequestSchema>
</Form>
</dd:dataDescription>
</xfa:datasets>
</xdp:xdp>
So the issue here is twofold:
1. What does the entire form appear twice in the XML output rather than just the repeating subform area?
2. Why are the subform form elements populating the XML?
Any help on this would be greatly appreciated.
I will be more than happy to answer any clarification questions if what I have stated is not clear.
Thanks in advance -
Ben Lyons
Views
Replies
Total Likes
Update:
So, I realized the reason that the XML was outputting the entire form is due to the way the LC process I created to output the sample XML outputs the data.
Using Adobe Acrobat to extract the XML from the form, it now looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<Form>
<ProviderAccessSiteRequestSchema>
<FacPracNm>Facility Name</FacPracNm>
<FacPracLn01Ad>1234 Fac Address St.</FacPracLn01Ad>
<FacPracCityAd>Businesstown</FacPracCityAd>
<FacPracStateAd>NY</FacPracStateAd>
<FacPracZipAd>12345</FacPracZipAd>
<TaxIDNo>000000000</TaxIDNo>
<SiteAdminEmailAd>jkfhkfkj@yhaoo.com</SiteAdminEmailAd>
<SiteAdminNm>jhfflk fllhjhfj</SiteAdminNm>
<UserDesigneeContainer> <--This is the subform container and subform that I am trying to get to repeat
<UserDesigneeSubform>
<UserFirstNm>hfhfhfh</UserFirstNm>
<UserLastNm>hjkjkjdhkdhkj</UserLastNm>
<UserAddChangeDelIn>Add</UserAddChangeDelIn>
<UserEmailAd>sjdjdj@hfhfh.com</UserEmailAd>
<UserTelNo>(555) 555-5555</UserTelNo>
</UserDesigneeSubform>
</UserDesigneeContainer>
</ProviderAccessSiteRequestSchema>
</Form>
So the whole "replication of the whole form issue" was my bad. So that answers part 1 of my original question.
Also - I have used the binding option "UseName" to bind the individual objects from the subform to my schema.
The end effect is also the XML seen above - so it is almost working - but. . . .
I had two subforms in the above example, and only one output data.
So if I had several subforms, what do I have to do so that it will reflect multiple subform instances with data entered into them?
I am trying to get to something like this, say there are 3 subforms:
<UserDesigneeContainer>
<UserDesigneeSubform>
<UserFirstNm>firstname01</UserFirstNm>
<UserLastNm>lastname01</UserLastNm>
<UserAddChangeDelIn>Add</UserAddChangeDelIn>
<UserEmailAd>sjdjdj@hfhfh.com</UserEmailAd>
<UserTelNo>(555) 555-5555</UserTelNo>
</UserDesigneeSubform>
<UserDesigneeSubform>
<UserFirstNm>firstname02</UserFirstNm>
<UserLastNm>lastname02j</UserLastNm>
<UserAddChangeDelIn>Del</UserAddChangeDelIn>
<UserEmailAd>bbbbbb@aaaaa.com</UserEmailAd>
<UserTelNo>(555) 555-4444</UserTelNo>
</UserDesigneeSubform>
<UserDesigneeSubform>
<UserFirstNm>firstname03</UserFirstNm>
<UserLastNm>lastname03</UserLastNm>
<UserAddChangeDelIn>Change</UserAddChangeDelIn>
<UserEmailAd>cccccc@ddddd.com</UserEmailAd>
<UserTelNo>(555) 555-6666</UserTelNo>
</UserDesigneeSubform>
</UserDesigneeContainer>
Any ideas?
Again, thanks in advance.
Views
Replies
Total Likes
Okay - I solved my issue.
And I am posting the answer for any other people who may find themselves in my situation.
The answer is twofold:
1. In your binding, you must include a bracket asterisk "[*]" to indicate that the subform can have multiple entities (see pic).
2. In your schema, the element that this is bound to, MUST declare that the maxOccurs="unbounded"; so in this instance:
<xs:element name="UserDesigneeSubform" maxOccurs="unbounded">
So - there you go.
Views
Replies
Total Likes
Nice find Ben, and thanks for taking time to post your solution.
Views
Replies
Total Likes