Skip to main content
Participant
June 9, 2019
Question

Hi Everyone - Please Help

  • June 9, 2019
  • 1 reply
  • 325 views

I am learning Java script on PDF. I have set each Required Field with a Pop Up if the section is clicked and not filled in

(Example)

f = getField(event.target.name)

if (f.value.length == 0)

    {

    f.setFocus()

    //Optional Message - Comment out the next line to remove

    app.alert("This field is required. Please enter your full name.")

    }

However, how do I make it so that the form is checked before being saved? I have searched and it seems as though I cannot however it looks like I can use a "Submit" box and add script there to not be hidden once the "required fields" are filled.

Once I put an "ok" box in, I entered the code for just the first page as this...

var aF = ["Text1", "Date2_af_date", "Initial343_es_:signer:initial", "Initial342_es_:signer:initial", "Initial341_es_:signer:initial", "Initial340_es_:signer:initial", "Initial339_es_:signer:initial", "Initial338_es_:signer:initial", "Initial337_es_:signer:initial", "Initial336_es_:signer:initial", "Initial335_es_:signer:initial", "Initial334_es_:signer:initial", "Initial333_es_:signer:initial", "Initial332_es_:signer:initial", "Initial331_es_:signer:initial", "Initial330_es_:signer:initial", "Initial329_es_:signer:initial", "Initial328_es_:signer:initial", "Initial327_es_:signer:initial", "Initial326_es_:signer:initial", "Initial325_es_:signer:initial", "Initial324_es_:signer:initial", "Initial323_es_:signer:initial", "Initial322_es_:signer:initial", "Initial321_es_:signer:initial", "Initial317_es_:signer:initial", "Initial318_es_:signer:initial", "Initial319_es_:signer:initial", "Initial320_es_:signer:initial"]; //change field names as needed

var sf = this.getField("Signature374");

sf.display = display.hidden;

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

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

   if (v !== "") {

       sf.display = display.visible;

       break;

   }

After I enter this in, it does not do anything. I know I am missing some steps....

The form is 16 pages and it's an application for hire. The applicants are filling out the form over computer and we are saving it in a folder.

I have been teaching myself how to do this so if you can help with a step by step, I would really appreciate it.

This topic has been closed for replies.

1 reply

try67
Community Expert
Community Expert
June 9, 2019

You can't prevent the file from being saved. What you can do is force the saved copy to be blank, or display an error message, either in a pop-up window or on the file itself, saying that not all fields have been filled in.

SamieOAuthor
Participant
June 10, 2019

Hi Try,

Yes, this is what I am aware of. I am new at this so I apologize for the confusion. I was wondering if there is a possibility for me to bypass it by adding an "OK" box/ Submit box at the end. I thought maybe I could code it somehow to pop up a notification that says which required filled was missed.

try67
Community Expert
Community Expert
June 10, 2019

Sure, that's possible. I've posted code that allows you to do that.

Try searching the forums for "validate required fields".