Check if row of fields contains blanks before pushing to array?
Hi all!
I am trying to build a form where the user can input data into several rows of fields. Once they are done, they can click a button at the bottom of the page which spawns a state form that is filled out with the data from the first page.
The data on the first page is grouped, meaning that I won't necessarily have all the info in consecutive order. For example, I might have Rows 1, 2, 5, and 7 filled out on page one, which need to be translated to Rows 1, 2, 3, and 4 on the spawned page.
I have written a function for this, but I want to add one more feature that I need help with. Right now, the function only works properly if ALL fields in a row have a value. If one of them is blank, it throws off the rest of the sheet. I'm looking for a simple way to check each row for blanks, and assign them a value of " " if the other fields in that row have a value already?
Function below:
function generate()
{
var nIndex = ["1.0", "1.1", "1.2", "1.3", "1.4", "2.0", "2.1", "2.2", "3.0", "3.1", "3.2", "3.3", "4.0", "4.1", "4.2"];
var iIndex = ["DOS", "CTA", "VIN", "CUST"];
var DOSarray = [];
var CTAarray = [];
var VINarray = [];
var CUSTarray = [];
var objArray = [DOSarray, CTAarray, VINarray, CUSTarray];
for (i = 0; i < iIndex.length; i++) {
//iterate through each prefix
for (n = 0; n < nIndex.length; n++) {
//iterate through each field
if (this.getField(iIndex + nIndex
).value !== "") { objArray.push(this.getField(iIndex + nIndex
).value); }
}
for (j=0; j < objArray.length; j++) {
this.getField("MVT_" + iIndex + Number(j + 1)).value = objArray
; }
}
}
I hope that makes sense. Any help would be greatly appreciated!
