Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

LiveCycle Dynamic form is resetting presence and values to default?

Avatar

Level 1

I have made quite a complex application form using LiveCycle 11 based on an XSD using Javscript.

I've got many problems with the state appearing to be reset but this is the easiest to explain.


There is a dropdown list that asks the user to select the type of Application. If they select MultipleI need to enable a dropdown with values in it and remove any previously instantiated forms. So I do this in the change event

if ($.boundItem(xfa.event.newText) == "Multiple Applicants") {

  pgMainForm.ddNoApplicants.access = "open";

  while(pgMainForm.frmApplicant1.all.length >1 )

  {

  xfa.resolveNode("pgMainForm._frmApplicant1").removeInstance(1);

  }

}

So as you can see I make ddNoApplicants usable and remove any extra instances of frmApplicant1

Then on the change event of ddNoApplicants I pick up what number they selected and instantiate new frmApplicant1's

xfa.form.Application.variables.ApplicantCount.value = xfa.event.newText;

for( var i = 0; i  < xfa.event.newText; i++){

  var j = i;

  var j = j+1;

  var newApp = xfa.resolveNode("pgMainForm._frmApplicant1").addInstance(true);

  newApp.frmPersonalDetails.tPersonalDetails.rCoApplicant.presence = "visible";

  newApp.frmPersonalDetails.tPersonalDetails.Row1.Text1.rawValue = "PERSONAL DETAILS - CO-APPLICANT " + j;

  newApp.frmPersonalDetails.tPersonalDetails.ContactHeader.Text1.rawValue = "CONTACT DETAILS - CO-APPLICANT " + j;

  newApp.frmPersonalDetails.tPersonalDetails.AddressHeader.Text1.rawValue = "ADDRESS DETAILS - CO-APPLICANT " + j;

  newApp.frmEmployment.tEmployment.EmploymentHeader.Text1.rawValue = "EMPLOYMENT DETAILS - CO-APPLICANT " + j;

  newApp.frmSolvency.tSolvency.SolvencyHeader.Text1.rawValue = "SOLVENCY DETAILS - CO-APPLICANT " + j;

  newApp.frmIncomeandExpense.tMonthlyIncome.MonthlyHeader.Text1.rawValue = "MONTHLY INCOME - CO-APPLICANT " + j;

  newApp.frmIncomeandExpense.tExpenses.rMonthlyExpenses.Text1.rawValue = "MONTHLY EXPENSES - CO-APPLICANT " + j;

  newApp.frmAssets.tAssets.AssetHeader.Text1.rawValue = "ASSET DETAILS - CO-APPLICANT " + j;

  newApp.frmLiabilities.tLiabilities.rHeader.Text1.rawValue = "LIABILITY DETAILS - CO-APPLICANT " + j;

  this.resolveNode("frmEnd.frmSignatures.CoApplicant" + j + "Sign").presence = "visible";

}

The above all works correctly. However when I now save the file with reader extensions and send it to the client they complete the first part and choose 2 applicants. All appears 100% and they save it and send it to the next person.

But when that person opens it the ddNoApplicants field is back to read only and defaultedto 0 and the titles have all been reset (The Co-Applicant wording no longer appears)

I have tried putting this on the Application::ready section

var oList = this.getDeltas();

for (i=0; i < oList.length; i++)

{

    var oDelta = oList.item(i);

    oDelta.restore();

}

but it has not helped,

The form is set to automatically save the state as well but it's not working.

I'm sure the problem exists around how I am instantiating new copies of the frmApplicant1 but I can't see a problem?

Please any help would be greatly appreciated.

Message was edited by: Zithelo Khumalo . Added some nice formatting

0 Replies