Skip to main content
Known Participant
April 17, 2019
Question

i have 3 text fields and need at least one of them to be completed in acrobat

  • April 17, 2019
  • 1 reply
  • 307 views

var aF = ["ECONOMY TOTAL", "SP SVC"];

var sf = this.getField("EXPRESS TOTAL");

for (var i = 0; i < aF.length; i++) {

    var v = this.getField(aF).value;

    if (v !== "") {

        this.getField("last 4 digits").required

        break;

    }

}

I have 3 text boxes all numerical values only, EXPRESS TOTAL, ECONOMY TOTAL & SP SVC, I would like at least one of these text boxes to be completed with a value greater than 0. If one box has information then the other 2 textboxes are not required to be completed

I started with the above as a custom calculation script for each of the text boxes but am unsure if i am doing this correctly

Also should the form when opened have these text boxes as required ticked at source and only when one of these 3 text boxes is completed with a value greater than 0  the required state for the other 2 textboxes will be removed

This topic has been closed for replies.

1 reply

Thom Parker
Community Expert
Community Expert
April 17, 2019

This is already answered in the Forms forum.

Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often