• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

PDF Forms

Explorer ,
Oct 13, 2020 Oct 13, 2020

Copy link to clipboard

Copied

I've searched through many of the posts/responses regarding how to lock certain form fields before submitting by email, copied many of the suggested scripts, but I'm still running into a problem with my Form.

 

The requirements are:  (1) 4 specific fields are "required entry", (2) signature field is also required.  At the bottom of my form are fields that are marked **For Office Use Only**, which I need to have available for entry afte the user has entered their data, clicked the button at the bottom of the form to lock the fields above and send it to the designated email address.  My problem is that the script checks for the "name" field (which is a required entry), but doesn't check for the other required fields.  And when I receive the completed document, the entire form is locked making it impossible to add the necessary validation (named Except1, Except2, Except3) at the bottom.  Below is my current script, and I can't figure out what I'm doing wrong:

 

var aExcept = [ "Except1", "Except2"];
var ok = true;

var i = 0;

for (i = 0; i < this.numFields; i++){

try{

var f = this.getField(this.getNthFieldName(i));

if(f.required==true){

if(f.value==f.defaultValue && f.type != 'button' && f.type != 'signature'){

ok=false;app.alert('Missing Value: '+f.name);

}

}

}catch(ex){};

};

if(ok==true){

for (var i = 0; i < this.numFields; i++){

var f = this.getField(this.getNthFieldName(i));

f.readonly = true;

 

I would appreciate any help available in order to complete this project.

TOPICS
PDF forms

Views

249

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 13, 2020 Oct 13, 2020

Copy link to clipboard

Copied

Hi,

 

My first thought would be how many fields are required? 

If it is not that many then just cycle through them rather than all the fields, the reason for this is that it would simplify your code as you wouldn't need to check for "required" and for it not being a "button" or "signature".

 

Without the actual form it is hard to spot an error, as it could be something as simple as a field missing the "required" setting, or it could be some other combination that is causing the problem.

 

Are you able to attach the form to the original post? or share it in some other manner?

 

Regards

Malcolm

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Oct 13, 2020 Oct 13, 2020

Copy link to clipboard

Copied

Hi, Malcom.

I'd much rather respond this way vs. having too much company information
out there. Attached is the form that I'm working on, with the 4
required fields so identified. Other fields (ie., check boxes, etc.) are
not required, and I've not finished up the final format at this point.

I thought I had the script figured out earlier, but when I sent to test it
- NOTHING.

Appreciate any help you can provide.

Regards,
Janie

--
*There is no power greater than a community discovering what it cares about
- ask "what's possible?" not "what's wrong?"*

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 13, 2020 Oct 13, 2020

Copy link to clipboard

Copied

Note that you are replying to the public forum, NOT via email to the person who replied.

Also, you can't attach files when replying via email. You have to do it through the browser.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 13, 2020 Oct 13, 2020

Copy link to clipboard

Copied

LATEST

In your script you doesn't use the variable aExcept.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines