I have in a table row 3 reguired fields and I am using the addInstance() to add repeating subforms.
I am using a script and sucesfully I validate the the(3) required fields.
But when I add another instance script does not work.....
How I can validate repeating fields(includes 3 required Textfields) for missing data
when the user clicks a email button?
Thanks
Views
Replies
Total Likes
Hi,
I suspect that the script works for the first instance, Row1, but as soon as you add more instances, the script does not know which instance is referenced, Row1[0], Row1[1], Row1[2], etc. When using JavaScript to reference instances, you need to resolve the node of each instance.
There are some table examples here: http://www.assuredynamics.com/index.php/code-solutions/table-solutions/ If you have a look at the script that loops through the rows, you will see the loop and the xfa.resolveNode.
Hope that helps,
Niall
Views
Replies
Total Likes
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
Views
Replies
Total Likes
Hi Steve,
Thank you for your reply in this matter.
For some reason I can not download your attachment.
Thank you
Views
Replies
Total Likes
You're welcome. I will try re-attaching.
Steve
Views
Replies
Total Likes
Looks like the forum software is misbehaving. If you send an email to stwalker.adobe@gmail.com I will forward the form.
Steve
Views
Replies
Total Likes