2 Replies Latest reply on Apr 5, 2015 4:19 PM by hasand59089870

    App.alert show over and over after each keystroke


      I am preparing a pdf form for my department in which doctors will need to quantify the amount of tracer found in 17 heart arteries. The amount of tracer in the patient will be compared when the patient is under stress and when he is at rest.

      Then it will calculate the sum of the 17 scores at stress (SSS) and the sum of the score at rest (SRS), and then will calculate the difference between the 2 scores (SDS).

      The rationale is that the score of each 17 segments at rest cannot (should not) be higher than the score at stress, however under a few circumstances this can happen. But to be sure that the user knows it's abnormal, it will tell that it should not be like that, and need to agree this is the case.


      The problem is that if this happen, each keystroke thereafter will re-trigger the question. How can I make sure that once it asks the question for that particular segment, it will not ask it again?


      The other issue is that in these rare cases, we still want to collect what should be the answer if this didn't happen. So I created another set of score at rest (these will be hidden on the final form, but left it there so I can see the results during the design of the form) that should copy the results of the raw data. But in the case of when the rest score is higher than the stress score, it will take the stress value. The problem is that it calculates the SRS one stroke late. How do I fix this?


      Here is a link to my form.

      Dropbox - Sample Perfusion form.pdf

        • 1. Re: App.alert show over and over after each keystroke
          try67 MVP & Adobe Community Professional

          You can make a hidden field that when the user first sees the message gets

          set with a certain value, and adjust the alert code to check the value of

          that field and only show the alert if that field is not a certain value.

          • 2. Re: App.alert show over and over after each keystroke
            hasand59089870 Level 2

            // The Fieldname shoud have the following hierarchy-Name-Format
            // It's important in my case that the naming of the fields for stress and rest perfussion have the follwing format: "Part1.Part2.99 " (Parent-Child-Format)
            // sample:
            // "Feld.sss.10", "Feld.sss.11"........"Feld.sss.27"
            // "Feld.srs.10", "Feld.srs.11"........"Feld.srs.27"
            // for this code its important that the last to char have two digits: 01 intead of 1, 02 instead of 2 etc..
            // Better you begin with 10 and 11,12,13..27

            // The other three result fields a named xsss, xsrs, xsds.

            // The two raw field, i didn't make. You must describe in more detail.
            // This is the main core. The rest is very little and easy.

            xFeldname = "Feld."        // Fieldname Part1 for Stress/Rest Perfusion (Parent or Groupname)
            xFeldExtSss = "sss."        // Fieldname Part2 for Stress Perfusion (Child 1)
            xFeldExtSrs = "srs."         // Fieldname Part2 for Rest Perfusion (Child 2)

            xFieldSSS = "xsss"          // Fieldname for calculated Field SSS (as I understand it: sum of the Stress Perfusion, less than 9)
            xFieldSRS = "xsrs"          // Fieldname for calculated Field SRS (as I understand it: sum of the Rest Perfusion, less than 9)
            xFieldSDS = "xsds"         // Fieldname for Field SDS (as I understand it: It's the difference from the Field SSS and SRS)

            sxsField = this.getField(xFeldname)
            sxsField.setAction("Validate", "xcompare(event.targetName, event.value)")


            if (typeof okFields == "undefined") {
                okFields = new Array()

            function xcompare(xField, xValue) {
                var xSuff = xField.substring(xField.length - 2)
                var srsName = xFeldname + xFeldExtSrs + xSuff
                var sssName = xFeldname + xFeldExtSss + xSuff

                if (xField == srsName) {
                    var xSSS = this.getField(sssName).value
                    var xSRS = xValue
                    var srsorsss = xFeldExtSrs
                } else {
                    var xSSS = xValue
                    var xSRS = this.getField(srsName).value
                    var srsorsss = xFeldExtSss       
                if (xSRS > xSSS) {
                    if (okFields.indexOf(xSuff) == -1) {
                        if (app.alert("..your alert: The SRS is bigger than SSS. Is this OK?......", 2, 2) == 4) {
                            this.getField(srsName).textColor = color.red
                            this.getField(sssName).textColor = color.red
                        } else {
                            event.rc = false
                } else {
                    var xFind = okFields.indexOf(xSuff)
                    if (xFind != -1) {
                        delete okFields[xFind]
                        this.getField(srsName).textColor = color.black
                        this.getField(sssName).textColor = color.black

                if (event.rc = true) xcalculate(xField, xValue, xSuff, srsorsss)

            function xcalculate(xField, xValue, xSuff, srsorsss) {
                var xTemp = xField.substring(0, xField.length - 2)
                var xSum = 0

                if (xValue >= 1 && xValue < 9) {
                    var sxsField = this.getField(xTemp)
                    var xTemp = sxsField.getArray()       
                    xSum = parseInt(event.value)
                    for (i = 0; i < xTemp.length; i++) {
                        if (xValue < 1 || xValue > 8) continue
                        if (xTemp[i].name == xField) continue
                        if (xTemp[i].value == "") continue
                        if (xTemp[i].value > 8) continue
                        xSum += parseInt(xTemp[i].value)       

                    if (srsorsss == xFeldExtSss) {
                        this.getField(xFieldSSS).value = xSum
                    } else {
                        this.getField(xFieldSRS).value = xSum

                    this.getField(xFieldSDS).value = this.getField(xFieldSSS).value - this.getField(xFieldSRS).value