5 Replies Latest reply on May 10, 2017 1:28 AM by rakeshk21205956

    Form Validation pop up menu formatting...

    rakeshk21205956 Level 1

      I have made one form which requires validation before signing....... everything is working good........ clicking validation button pops up a message about which fields need to be filled (if any require fields are not filled by user)..

       

      Now i want to ask is it possible in pdf form that instead of pop up message..... the fields which are not filled by users are highlighted in red there itself instead of a popup message (bcoz the formatting of pop up is very bad and i am not able to format the popup mssg.. they come up very messy).

        • 1. Re: Form Validation pop up menu formatting...
          Karl Heinz Kremer Adobe Community Professional

          There are three colors that you can set for a field:

           

          1. text color

          2. background color

          3. border color

           

          When you have the "highlight fields" function active, the background color will only be shown when your field is active (because only one field can be active at any time, only one field would show your "this field needs to be filled out" color). I usually change both the border color and the highlight color, so even with the highlight function being active, the border color would still show.

           

          You can change the border/background color via the Field.strokeColor and Field.fillColor properties. In your validation script, you would access these via the "event.target" property:

           

          if (something == true) {
            event.target.fillColor = color.red;
            event.target.strokeColor = color.red;
          }
          else {
            event.target.strokeColor = color.green;
            event.target.fillColor = color.green;
          }
          
          • 2. Re: Form Validation pop up menu formatting...
            rakeshk21205956 Level 1

            I was not looking for something  this

            validation-main.png

            • 3. Re: Form Validation pop up menu formatting...
              rakeshk21205956 Level 1

              i mean i was actually looking like the image in the above post...... if validation fails then such mssg should appear above or below the field

              • 4. Re: Form Validation pop up menu formatting...
                Karl Heinz Kremer Adobe Community Professional

                In that case, you have to add a read-only field that you show/hide depending on the state of your actual (validated) field. You do this via the Doc.display property: Acrobat DC SDK Documentation

                • 5. Re: Form Validation pop up menu formatting...
                  rakeshk21205956 Level 1

                  Please see the following thread:

                  https://forums.adobe.com/message/9506221#950622

                   

                  Sir,

                  I have a two fields Text3 in which user inputs the any date.... and Text4 in which by default it should be Text 3  + 30 days....... but if users want to change the date in Text4 they can do so but within the range of Text 3  + 45 days. 

                   

                   

                  I have put the following script in the calculation tab of the Text4 field:

                   

                  var sDate = this.getField("Text3").value; // get date string

                   

                  var oDate = util.scand("mm/dd/yyyy", sDate); // convert to object

                   

                  var nDay = 1000 * 60 * 60 * 24; // define 1 day in milliseconds

                   

                  var nDate = oDate.getTime() + (30 * nDay); // add 7 days as milliseconds

                   

                  oDate = new Date(nDate); // convert milliseconds to date object

                   

                  defau= util.printd("mm/dd/yyyy", oDate); // format result

                   

                   

                   

                  var endDate = this.getField("Text3").value; // get date string

                   

                  var pDate = util.scand("mm/dd/yyyy", endDate); // convert to object

                   

                  var eDay = 1000 * 60 * 60 * 24; // define 1 day in milliseconds

                   

                  var eDate = pDate.getTime() + (45 * eDay); // add 7 days as milliseconds

                   

                  pDate = new Date(eDate); // convert milliseconds to date object

                   

                  end= util.printd("mm/dd/yyyy", pDate); // format result

                   

                   

                   

                  var startDate = this.getField("Text3").value; // get date string

                   

                  stDate = util.scand("mm/dd/yyyy", startDate); // convert to object

                   

                   

                  var currentField = this.getField("Text4").value;

                   

                  eventDate = util.scand("mm/dd/yyyy", currentField); // convert to object

                   

                   

                  if (stDate <= eventDate && eventDate <= end) {event.value = event.value}

                   

                  else { event.value = ""}

                   

                   

                   

                  But the output is always the "defau"    ....... even if it input the correct range value in Text4.

                   

                  Plz guide..