Expand my Community achievements bar.

Problems with empty elements when saving a form

Avatar

Level 2

Hi

I have designed a form that has multiple contacts subforms, and in the xsd I have a sequence with element name="Customer".

                                     <xs:sequence>

                                      <xs:element name="Customer" minOccurs="0" maxOccurs="unbounded">
                                             <xs:complexType>
                                                 <xs:sequence>
                                                     <xs:element name="CustomerId" type="xs:int" />
                                                     <xs:element name="CustomerName1" type="xs:string" />
                                                     <xs:element name="CustomerName2" type="xs:string" />
                                                     <xs:element name="FullName" type="xs:string" />                                                   
                                                     <xs:element name="Address1" type="xs:string" />
                                                     <xs:element name="PostCode" type="xs:string" />
                                                     <xs:element name="PostArea" type="xs:string" />
                                                     <xs:element name="PhonePrivate" type="xs:string"/>
                                                     <xs:element name="PhoneWork" type="xs:string" />
                                                     <xs:element name="PhoneMobile" type="xs:string"/>
                                                     <xs:element name="Fax" type="xs:string" />
                                                     <xs:element name="OrganizationNumber" type="xs:string"/>
                                                     <xs:element name="SocialsecNumber" type="xs:string" />
                                                     <xs:element name="CompanyMail" type="xs:string" />
                                                 </xs:sequence>
                                             </xs:complexType>
                                         </xs:element>
                                     </xs:sequence>

Some of these elements will always be empty. In this cae the first contact has a social security number and the second contact  has a organization number. But when I save the XML the data does not get saved in different sequences. The XML turns out like this:

  <Customer>
           <CustomerId>1000957</CustomerId>
           <CustomerName1>abc</CustomerName1>
           <CustomerName2>def</CustomerName2>
           <FullName />
          <OrganizationNumber>23123131231</OrganizationNumber>
           <Address1>adress</Address1>
           <PostCode>000</PostCode>
           <PostArea>aaaa</PostArea>
           <PhonePrivate>32131231</PhonePrivate>
           <PhoneWork />
           <PhoneMobile>213123</PhoneMobile>
           <Fax />
           <SocialsecNumber>200476134565</SocialsecNumber>
           <CompanyMail />
    </Customer>
    <Customer>
           <CustomerId>1000958</CustomerId>
           <CustomerName1 />
           <CustomerName2 />
           <FullName>company name</FullName>
           <OrganizationNumber />
           <Address1>adress/Address1>
           <PostCode>000</PostCode>
           <PostArea>aaa</PostArea>
           <PhonePrivate />
           <PhoneWork>324234234</PhoneWork>
           <PhoneMobile />
           <Fax />
           <SocialsecNumber />
           <CompanyMail>info@info.no</CompanyMail>
         </Customer>
    

The tag <OrganizationNumber> in the first sequence is filled with data which should have been in the second sequence.

What can I do to keep the elements empty when I save the form?

Thanks

8 Replies

Avatar

Former Community Member

Can you post your form so we can see what you have done?

Paul

Avatar

Level 2

Hi

Here is the form I am using. The problem is on step two "Fødselsnr."  and "Organisasjonsnr.". The data in those two fields should be in different sequences.

I had to rename the extention from .xdp to pdf.

Thanks

Cathrine

Avatar

Former Community Member

I am even more confused now. What language is that. Where are you based? This is a complex application (more than a form) and needs much more investigation. Also I see things in the form that I have to ask you about. Why do you set values from the data dom to the field directly. Why are you not letting the binding take care of it? Do you have Maintenance and Support (I only ask because we may be able to get you help locally).

Paul

Avatar

Level 2

Hi

The language is Norwegian, I am based in Norway. We have many forms like this and we render them throug Adobe LiveCycle Forms. The form is working perfectly (some bug of course, but nothing big).

Yes we have a support agreement, but I wanted to try this first :-)

Which fields do you mean? "Why do you set values from the data dom to the field directly".

The contact forms are working as arrays. The first binding is number 1 (Customer[*].CustomerId) and so on. My problem lies in one of the nodes in the XML. The data does not keep in its field. When the data is put back in the form it shows in the right place, but it is still wrong in the XML. I have simplified the form to only show the contacts. Have also attached the saved XML. 

Hope this is more understaning.

Thanks

//Cathrine

Avatar

Former Community Member

I found this code on the form .....I do not have the button to validate it:

Form.Page2._01_flowed.contactform1_flowed[0].selectContact_pos.bnSelect::click - (JavaScript, client)

//get the Id for the selected company

var

customerId = CompanyList.rawValue;

if

(customerId != null){

//Get xml node for the company

var customer = CommonScript.getCompanyById(customerId);

//Debug

//xfa.host.messageBox("Velg: " + customerId);

//Populate the form with values

var node = contactform1_pos.contactform1_graphic; //Change this to reflect the node position in the template

node.CustomerId.rawValue

= customer.resolveNode("CustomerId").value;

node.FullName.rawValue

= customer.resolveNode("CustomerName2").value + " " + customer.resolveNode("CustomerName1").value;;

node.CustomerName1.rawValue

= customer.resolveNode("CustomerName1").value;

node.CustomerName2.rawValue

= customer.resolveNode("CustomerName2").value;

//node.OrganizationNumber.rawValue = customer.resolveNode("OrganizationNumber").value;

node.SocialsecNumber.rawValue

= customer.resolveNode("SocialsecNumber").value;

node.Address1.rawValue

= customer.resolveNode("Address1").value;

node.PostCode.rawValue

= customer.resolveNode("PostCode").value;

node.PostArea.rawValue

= customer.resolveNode("PostArea").value;

node.PhoneWork.rawValue

= customer.resolveNode("PhoneWork").value;

node.PhonePrivate.rawValue

= customer.resolveNode("PhonePrivate").value;

node.PhoneMobile.rawValue

= customer.resolveNode("PhoneMobile").value;

node.Email.rawValue

= customer.resolveNode("CompanyMail").value;

node.Fax.rawValue

= customer.resolveNode("Fax").value;

}

The customer.resolveNode("field").value is a call to an XML value .....I am assuming it is in the DataDom.

I do not like the way you do your binding. I prefer to build up the binding through relative references. I modified it in this sample and it seems to be working fine. I lik to bind the repeating subform to the repeating node in the XML then all children of that node have much simpler binding expressions relative to the repeating node.

Anyways I did it for your two repeating sections and I think I am getting the right data....you tell me!

This type of binding makes it asier for you ....if you want to display all Customers you can simply click on the check box "Repeat subform for each data item" and it is done for you.

Let me know what you think. I attached my modified sample for your review.

Paul

Avatar

Level 2

Hi

Thanks, but in this form the fist field overrigths the second ( if I´m not missing something).

The binding is like this because of the structure in the xsd file. These forms may have up to 6-7 contact sub forms.


We have a web solution that allows users to fill out the forms and save them in our database as XML. In this solution we have an interface for filling out contact information and project data which is selected into the XML as the form renders. When we render the form we pre fill data into the dropdown box so that the user can select the right contact. Which I can see from your test form, I have to give the fields unique names so the first value doesn’t overwrite all the others values with the same name. Therefore we use [*]. This way may not be optimal, but it works. The only problem I have is that when I save the form as XML, it can’t separate the “SocialsecNumber (date of birth)” and “OrganizationNumber (VAT)” on the right customerid. All the other data is in the right customerid event the data nodes is empty on first customerid.

//Cathrine

Avatar

Former Community Member

I have no idea why this is happening ......you will have to open an incident with support to get it looked at by R&D.

Sorry

Paul

Avatar

Level 2

Thanks for trying :-)

//Cathrine