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

Required field alert upon submission

New Here ,
Sep 09, 2020 Sep 09, 2020

I have set several fields in my form to required. If the field is not completed upon submission the Adobe acrobat error message appears stating that at least one field is empty.

Is there a way to specify which fields are empty? Specify a list of empty fields the user needs to go back and complete? Instead of just a general statement.

If so how would I go about doing that? This is my 1st form I am completing.

TOPICS
PDF forms
6.4K
Translate
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 ,
Sep 10, 2020 Sep 10, 2020

Check the JS Console after clicking one of those check-boxes...

Translate
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
New Here ,
Sep 10, 2020 Sep 10, 2020

Okay,

I've spent hours trying to figure out why the grant field will not validate. I looked at the JavaScript I'm not sure what I'm even looking for. I erased every reference in the JavaScript that referenced the grant field and not to work. Even when it was erased some of the commands still worked. Not sure why that happened. Any suggestions would be greatly appreciated. I am so close to getting this exactly how I need it.

Translate
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 ,
Sep 11, 2020 Sep 11, 2020

This is the error message I'm getting:

 

TypeError: this.getField("grayimage") is null
16:Field:Mouse Up

 

It happens because there's no field with that name, and it causes the rest of the code to not work.

Translate
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 ,
Sep 15, 2020 Sep 15, 2020

Hi,

I've used the code below which works fine, this was taken from the code discussion above, all works fine apart from the email doesn't show the subject line, any help appreciated.  Thanks Paul

 

// This is the form return e-mail. Its hardcoded // so that the form is always returned to the same address // Change address on your form var cToAddr = "Colette.Williams@sjp.co.uk"; var cCCAddr = "" // Set the subject and body text for the e-mail message var cSubLine = "St. James's Place PC Consultancy Request Form"; var cBody = ""; var emptyFields = []; for (var i=0; i<this.numFields; i++) { var f= this.getField(this.getNthFieldName(i)); if (f.type!="button" && f.required ) { if (f.defaultValue==f.valueAsString) emptyFields.push(f.name); } } if (emptyFields.length>0) { app.alert("Error! You must fill in the following fields:\n" + emptyFields.join("\n")); } else this.mailDoc({cTo: "Colette.Williams@sjp.co.uk"});

Translate
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 ,
Sep 15, 2020 Sep 15, 2020
LATEST
@PerivanP

Your last comment does not appear in the forums due to a bug that prevents
more than 25 (sub-)replies under a single thread... Please post it as a new
reply.
Translate
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