2 Replies Latest reply on Apr 7, 2014 4:56 AM by mifamac

    To initiate a validation of all fields in a form

    mifamac

      Hi,

       

      I have a PDF Form with some fields (A, B, C, D).

      The user fills in the fields with numbers that have to be in an specific range (e.g. between 600 and 1850 mm in field B).

      These fields are validated on return. (fig01-fig03)

       

      In field D the user can enter a value between min 0 and max dimension that depends on the value entered in field B. This is validated (fig03).

       

      User enters in field B: 1800; the result is 1200 max. dimension for field D; user enters value 1200 in field D;

       

      Now my problem:

      User deside to enter a lower value in field B; but the value of field D entered previously is not validated again!

      There should be an additional validation (cross-validation) for field D when the user enters a value in field B; I have no idea how to to this...

       

      For further explanation 3 pdfs:

      http://gofile.me/24Xga/f77EWFFw

      http://gofile.me/24Xga/jo8tnPOX

      http://gofile.me/24Xga/NlHQkqGI

       

       

      Any help is appreciated.

       

      Thanks in advance

      mifa

        • 1. Re: To initiate a validation of all fields in a form
          try67 MVP & Adobe Community Professional

          One possible solution is to reset field D whenever field B is updated. Otherwise, you will need to copy your validation script (of the D value) into field B and run it when that field is updated as well.

          • 2. Re: To initiate a validation of all fields in a form
            mifamac Level 1

            Hi, thanks for your reply.

             

            This is my actual code for validation of field b1. It does not work properly. Sometimes the wrong value in field d1 is noted, sometimes not.

             

            The second problem: Is it possible not only to reject the wrong value but to put in the max. possible value?

             

             

             

             

            // Benutzerdefinierte Ueberprüfung

            (function () {

             

             

                // Get this field value, as a number

                var b1a = +event.value;

             

                // Max-Min Werte

                var b1max = 1850;

                var b1min = 600;

             

                // Testen ob Wert über 1850 liegt

                if (b1a > 1850) {

             

                    // Fehlermeldung

                    app.alert("Wert darf nicht größer sein als 1850!");

             

                    // Reject the value that the user entered

                    event.rc = false;

             

                }

             

             

                // Testen ob Wert unter 600 liegt

                if (b1a < 600) {

             

                    // Fehlermeldung

                    app.alert("Wert darf nicht kleiner sein als 600!");

             

                    // Reject the value that the user entered

                    event.rc = false;

                }

             

             

                // Get the value in the d2max field, as a number

                var v1a = +getField("d1max").value;

             

                // Get this field value, as a number

                var v2a = +getField("d1").value;

             

                // Test if this field value is greater than the number of d1max

                if (v2a > v1a) {

             

                    // Fehlermeldung

                    app.alert("Größe D darf nicht größer sein als " +v1a +"!");

             

                    // Reject the value that the user entered

                    event.rc = false;

                }

             

             

                // Test if this field value is greater than the number of d1max

                if (v2a < 0) {

             

                    // Fehlermeldung

                    app.alert("Wert darf nicht kleiner sein als 0");

             

                    // Reject the value that the user entered

                    event.rc = false;

                }

            })();

             

             

            Thanks

            mifamac