How to set 1st number in row = 10, and increment by 10 every time Button to Add new row is pressed. Also allow users to enter generic numbers, i.e 13 and still increment by 10 to be 23 or whatever.
I already have my table set up with a Button that will add new rows when pressed.
I now want to specify that the 1st row is 10 and any other rows after that increment by 10. This will also allow users to enter any number they'd like and the next row will increment by 10.
Help please.
Solved! Go to Solution.
Views
Replies
Total Likes
Try changing the add row button to have the following JavaScript
var newRow = Table1._Row1.addInstance()
if (newRow.index > 0)
{
newRow.NumericField1.rawValue = newRow.resolveNode('Row1[-1].NumericField1').rawValue + 10;
}
You will have to change this code to match your form names, but basically the addInstance() method will return the new row, the newRow.resolveNode('Row1[-1]... will get the value of the previous row and then we add 10.
Regards
Bruce
Views
Replies
Total Likes
Try changing the add row button to have the following JavaScript
var newRow = Table1._Row1.addInstance()
if (newRow.index > 0)
{
newRow.NumericField1.rawValue = newRow.resolveNode('Row1[-1].NumericField1').rawValue + 10;
}
You will have to change this code to match your form names, but basically the addInstance() method will return the new row, the newRow.resolveNode('Row1[-1]... will get the value of the previous row and then we add 10.
Regards
Bruce
Views
Replies
Total Likes
Hi Bruce,
I am very new with LiveCycle Designer and appreciate your response very much.
For the add row button, can you specify where to put this script? I put the script into the "click*" area and also changed the table name to match my own but I am not getting it to work when I Preview PDF.
-Nancy
Views
Replies
Total Likes
Hey Bruce,
Thanks so much for your code! It worked! I did some minor tweeking.
var newRow = Main.JPTaskDesc._Row1.addInstance(1)
if (newRow.index > 0)
{
newRow.NumericField1.rawValue = newRow.resolveNode('Row1[-1].NumericField1').rawValue + 10;
}
and this worked perfectly. I cannot thank you enough! Thanks again.
-Nancy
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies
Views
Likes
Replies