5 Replies Latest reply on Feb 12, 2018 1:17 PM by George_Johnson

    app.alert and if

    DrAlghazali

      I have a form and one of the text fields is called BP

      I am tryning to figger out a way to have an alert =, if the BP (Blood Pressure) is >=160/100 an alert will pop up "High Blood Pressure!"

      and if the blood pressure is <= 90/60 an alert will pop up "Low blood pressure!"

       

      please any hlep

        • 1. Re: app.alert and if
          George_Johnson MVP & Adobe Community Professional

          That might be kind of difficult if you're using just a single field for the systolic and diastolic values. If you use separate fields, it becomes easier, and easier to validate entries, since they will be numbers instead of a string that you have to parse to extract the two values. Also, would both values have to exceed their respective upper limits (e.g., 161/101) to be considered too high, or just one (e.g., 161/99)?

          • 2. Re: app.alert and if
            DrAlghazali Level 1

            greetings Mr. George

            thanks for your reply

             

            unfortunately the feild should be one only not more, for the value if both exceeded the limit is acceptable

             

            thank you again

            • 3. Re: app.alert and if
              try67 MVP & Adobe Community Professional

              Use this code as the field's custom validation script:

               

              if (event.value) {
                  var parts = event.value.split("/");
                  if (parts.length==2) {
                      var v1 = Number(parts[0]);
                      var v2 = Number(parts[1]);
                      if (!isNaN(v1) && !isNaN(v2)) {
                          if (v1>=160 && v2>=100) app.alert("High Blood Pressure!",1);
                          if (v1<=90 && v2<=60) app.alert("Low Blood Pressure!",1);
                      }
                  }
              }
              
              • 4. Re: app.alert and if
                DrAlghazali Level 1

                Mr. Gilad

                 

                Thank you Very much

                you are a legend really

                • 5. Re: app.alert and if
                  George_Johnson MVP & Adobe Community Professional

                  If this is going to be used for anything important, consider adding additional validations to catch erroneous inputs. For example, check to make sure the values are within a reasonable range (e.g., 50-300 / 20-200), that systolic is greater than diastolic, etc.

                  1 person found this helpful