Hi,
I´m using a subform with a field(jobs_num) that is the row number +1(because the subform rows begins with 0). The problem is when the user deletes a row. For example if the form has 6 rows, when I delete row 2 and add a new one, the Jobs_num of that row will be 6 again.
How can I solve this problem?
Thanks!
Regards,
Rui
Welcome to the nuBuilder Forums!
Join our community by registering and logging in.
As a member, you'll get access to exclusive forums, resources, and content available only to registered users.
Join our community by registering and logging in.
As a member, you'll get access to exclusive forums, resources, and content available only to registered users.
Number subform rows
Re: Number subform rows
Rui,
Are you doing this with JavaScript when it loads or php when it saves?
Steven
Are you doing this with JavaScript when it loads or php when it saves?
Steven
-
- Posts: 177
- Joined: Tue Nov 15, 2011 2:24 pm
Re: Number subform rows
Hi Steven,
I'm doing this with JavaScript when the field Jobs_Code is getting a value.
Regards,
Rui
I'm doing this with JavaScript when the field Jobs_Code is getting a value.
Regards,
Rui
BR
Rui
Rui
-
- Posts: 177
- Joined: Tue Nov 15, 2011 2:24 pm
Re: Number subform rows
Rui,
Use this to get the next number..
Steven
Use this to get the next number..
Code: Select all
function getNextNo(){
var theSubform = 'receipt_subform'; //---- the name of the subform
var theField = 'receipt_id'; //---- the name of the fields with the generated number
var biggestNo = Number(0);
var theList = nuSubformRowArray(theSubform);
for (var i = 0 ; i < theList.length ; i++){
var thisNo = Number(document.getElementById(theList[i] + theField).value);
biggestNo = math.Max(biggestNo, thisNo);
}
return Number(biggestNo) + 1;
}
Steven
-
- Posts: 177
- Joined: Tue Nov 15, 2011 2:24 pm