Avatar

Level 10

This is likely very similar to Niall's examples.

I have a Button object called 'emailBtn' and labelled 'Email'. I have an Email Submit Button called 'emailSubmitBtn' that is hidden. When you click 'emailBtn' the click event iterates over a table body row checking each 'quantity' object instance. There are two counters, one for the number of rows ('cnt') and a second to keep track of the number of populated 'quantity' instances. If the validated count equals the row count the click event on 'emailSubmitBtn' is called.

// form1.page1.subform1.emailBtn::click - (JavaScript, client)

var cnt = form1.page1.subform2.table._row.count;

var validRowCnt = 0;

for (var i = 0; i < cnt; i++) {

  var qty = xfa.resolveNode("form1.page1.subform2.table.row[" + i + "].quantity").rawValue;

  if (qty == null || qty == 0) {

    xfa.host.messageBox("The part quantity in row " + (i+1) + " is missing.");

  }

  else {

    validRowCnt = validRowCnt + 1;

  }

}

if (validRowCnt == cnt) {

form1.page1.subform1.emailSubmitBtn.execEvent("click");

}

Steve