How to identify Rows

1,285 views
Skip to first unread message

mohan

unread,
Sep 25, 2007, 11:33:57 PM9/25/07
to Adobe LiveCycle Developers
hi,

I have a table that has one row.
I can add upto five rows by clicking a button that has addInstance()
method.
How can I identify a particular row (for eg 3rd row) and retrieve a
value in that row.
Please help me to get a solution for this problem.

Another Question

How can i get the index of a text in the drop down list box?
For e.g I have three text in the dropdown list namely 1st, 2nd and 3rd
How can I get the index value of the text by scripting?

John Nesbitt

unread,
Sep 27, 2007, 7:30:14 PM9/27/07
to Adobe LiveCycle Developers
Mohan,

It depends if you are using JavaScript or FormCalc.

For JavaScript, you use the resolveNode method. For example:

var thirdRow =
yourTableName.resolveNode("yourRowName[3]").yourFieldName.rawValue;

For FormCalc, you can just use the instance index. For example:

yourTableName.yourRowName[3].yourFieldName


If you want to calculate the total of a column in JavaScript:

var rowCount = yourTableName.yourRowName.instanceManager.count;
var yourTotal;

for (var i = 0; i < rowCount; i++) {
var currentRow = yourTableName.resolveNode("yourRowName[" + i +
"]");

yourTotal = yourTotal + currentRow.yourFieldName.rawValue;
}

yourTableName.yourFooterRowName.yourTotalField.rawValue = total;


----------------------------------------------------

As for the index of a text value in a list box, if you want the
current value (in JavaScript):

yourListName.rawValue;

To get the displayed text of the list (in JavaScript):

var numOptions = yourListName.length;

for (var i = 0; i < numOptions; i++) {
app.alert(yourListName.items.nodes.item(i).value);
}

Hope this answers your questions,
John.

mohan

unread,
Sep 28, 2007, 1:03:15 AM9/28/07
to Adobe LiveCycle Developers
John Nesbitt,

What u told works perfectly. Thanks a lot for your answer

Regards,
Mohan

John Nesbitt

unread,
Sep 28, 2007, 1:33:25 AM9/28/07
to Adobe LiveCycle Developers
Mohan,

No worries.

Not sure if I'm allowed to post promotions to books here, but I
honestly think that the book "Creating Dynamic Forms with Adobe
LiveCycle Designer" (http://www.peachpit.com/store/product.aspx?
isbn=0321509870) would be an invaluable asset for you. It is great for
beginners and advanced users alike - I got my $40 worth out of it
already and I'm only half way through (and I've been using LiveCycle
products for almost a year now).

John.

Reply all
Reply to author
Forward
0 new messages