Hi Every one , How to i get to automatically get each rows in a subform to have a number autogenerated in one of the fields.
i want to say that i want a receipt id to be generated uniquely automatically for each rows that exists in the sub form
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.
HELP with Row
Re: HELP with Row
at_rcc,
you can put this code in the JavaScript section of the form which has the subform.
nuLoadThis() will be run automatically as the Form loads.
nuSubformRowArray() is a nuBuilder function that returns an array of each row's prefix.
regards
Steven
you can put this code in the JavaScript section of the form which has the subform.
Code: Select all
function nuLoadThis(){
var subformToPopulate = 'receipt_subform'; //---- the name of the subform
var fieldToPopulate = 'receipt_id'; //---- the name of the field to populate
var lastNumberFrom = 100;
var theList = nuSubformRowArray(subformToPopulate);
for (var i = 0 ; i < theList.length ; i++){
var fieldInRow = document.getElementById(theList[i] + fieldToPopulate);
if(fieldInRow.value == ''){
fieldInRow.value = lastNumberFrom;
lastNumberFrom = lastNumberFrom + 1;
}else{
lastNumberFrom = Number(fieldInRow.value) + 1;
}
}
}
nuLoadThis() will be run automatically as the Form loads.
nuSubformRowArray() is a nuBuilder function that returns an array of each row's prefix.
regards
Steven