These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Controlling a dynamic Table with a Checkbox (InstanceManager, moveInstance issue)

nikg
Registered: Apr 18 2011
Posts: 2

Hello,
I am having some problems in using InstanceManager (dynamic tables). I try to add and delete new rows by using checkboxes. If a checkbox gets clicked a new row, with a value given from the checkbox, appears. If a checkbox gets deactivated, then the row, it has created, is going to be removed.
 
I have uploaded my form to: www.hs-augsburg.de/~nikg-fh/mypdf.pdf
 
Table Overview:
MyTable
- MyHeader
- MyRow (rowIndex, rowNumber, CheckBoxValue, fromIndex, toIndex)
 
There are 3 checkboxes on page 1 (checkBox1, checkBox2, checkBox3) (they have the same coding)
  
Table behavior:
 
initial = any checkbox klicked:

rowIndex rowNumber CheckBoxValue fromIndex toIndex
     0       1

  
checkbox1 = klicked:
rowIndex rowNumber CheckBoxValue fromIndex toIndex
    0        2
    0        2       CheckBox1       0        1

 
checkbox2 = klicked:
rowIndex rowNumber CheckBoxValue fromIndex toIndex
    0        3       Checkbox1       0        1
    1        3
    0        3       CheckBox2       0        2

 
checkbox3 = klicked:
rowIndex rowNumber CheckBoxValue fromIndex toIndex
    1        4
    0        4       Checkbox2       0        2
    1        4
    0        4       CheckBox3       0        3

      
I hope anyone could help me with the JavaScript for mentioned scenario.
 
MyForm.page1.checkbox1::change - (JavaScript, client)
&nbsp;<br />
if (this.rawValue == "1")
{
var myInstance = xfa.form.MyForm.page1.MyTable._MyRow.addInstance(1);
var fromIndex = xfa.form.MyForm.page1.MyTable._MyRow.index;
var toIndex = myInstance.index;
// Value of col. "CheckBox-Value"
xfa.form.MyForm.page1.MyTable.MyRow.checkboxValue.rawValue = "CheckBox 1";
// Value of col "fromIndex"
xfa.form.MyForm.page1.MyTable.MyRow.fromIndex.rawValue = fromIndex;
// Value of col "toIndex"
xfa.form.MyForm.page1.MyTable.MyRow.toIndex.rawValue = toIndex;
// Move Row
xfa.form.MyForm.page1.MyTable._MyRow.moveInstance(fromIndex, toIndex);
}
else
{
var rowToDelete = xfa.form.MyForm.page1.MyTable._MyRow.index;
xfa.form.MyForm.page1.MyTable._MyRow.removeInstance(rowToDelete);
xfa.form.MyForm.page1.deletedRow.rawValue = rowToDelete + 1;
}

 
MyForm.page1.MyTable.MyRow.rowIndex::calculate - (JavaScript, client)
this.rawValue = MyRow.index;

 
MyForm.page1.MyTable.MyRow.rowNumber::calculate - (JavaScript, client)
var mycounter = _MyRow.count;
this.rawValue = mycounter;

My Product Information:
LiveCycle Designer, Windows
nikg
Registered: Apr 18 2011
Posts: 2
actually I just need to know how I could pass over the values to the line, which was just added.

this code is obvious wrong for that purpose:
xfa.form.MyForm.page1.MyTable.MyRow.checkboxValue.rawValue = "CheckBox 1";