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

required fields in acrobat 2017

Participant ,
Jun 14, 2018 Jun 14, 2018

Copy link to clipboard

Copied

Is there something odd about making required fields in Acrobat 2017.

I want to test for required fields when using the  File Save menu, not under a button.

Tried code below, used to work in acrobat XI.

Ideas?

function validateFields()

{

//a counter for the number of empty fields

var flg = 0

// count all the form fields

var n = this.numFields

//create an array to contain the names of required fields

//if they are determined to be empty

var fArr = new Array();

//loop through all fields and check for those that are required

// all fields that have a '*' in their tool tip are required

for(var i = 0;i<n;i++){

var fn = this.getNthFieldName(i);

var f = this.getField(fn);

//tool tip is the fields\'s 'userName' property;

var tt = f.userName

//test for the '*';

if(tt.indexOf('*')!=-1 && f.value == f.defaultValue){

//increment the counter of empty fields;

flg++;

//add the fields userName (tool tip) to the list of empty field names;

fArr[fArr.length] = tt;

}

}

//now display a message if there are empty fields

if(flg>0){

app.alert('There are '+flg+' fields that require a value\n\n'+ fArr,3)

}

else{

this.save();

}

}

TOPICS
PDF forms

Views

957

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
1 ACCEPTED SOLUTION
Community Expert ,
Jun 14, 2018 Jun 14, 2018

Copy link to clipboard

Copied

Nothing has changed.

View solution in original post

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 ,
Jun 14, 2018 Jun 14, 2018

Copy link to clipboard

Copied

Nothing has changed.

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
Participant ,
Jun 14, 2018 Jun 14, 2018

Copy link to clipboard

Copied

Ok thanks, so this code was for a button. Is there some code that is based on the File Save? So no button, but if Save or Save As is used, it tests for required?

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 ,
Jun 14, 2018 Jun 14, 2018

Copy link to clipboard

Copied

Yes, the code was for a button.

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
Participant ,
Jun 14, 2018 Jun 14, 2018

Copy link to clipboard

Copied

What about no button at all. When you go File Save, if the field is blank you get a popup to complete field?

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 ,
Jun 14, 2018 Jun 14, 2018

Copy link to clipboard

Copied

You can do that, but you can't prevent the file from being saved.

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
Participant ,
Jun 14, 2018 Jun 14, 2018

Copy link to clipboard

Copied

do you mean I would get the pop up, and it would also save? Defeating the purpose?

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 ,
Jun 14, 2018 Jun 14, 2018

Copy link to clipboard

Copied

Defeating your purpose, not the user's...

You can force the saved copy to be blank, though, or to contain a large

error message.

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
Participant ,
Jun 14, 2018 Jun 14, 2018

Copy link to clipboard

Copied

ok, so I am not seeing a fix here.

confusing......I can force it to be saved blank or contain a large error message??

No idea what to do with this....

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
Participant ,
Jun 14, 2018 Jun 14, 2018

Copy link to clipboard

Copied

LATEST

Thanks anyways.....

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