Expand my Community achievements bar.

Checking that required fields have been completed?

Avatar

Level 2

Short of a "brute force" appraoch of checking each named object isn't null or "", is there a more elegant way, somewhat similar to what Paul put together for making all the fields read-only,  to check that all the required fields in a form have been completed before firing off the email button?

1 Reply

Avatar

Level 10

There are many ways...

The simplest is setting your required fields to "mandatory" and using execValidate() from your submit/print/etc. button.

if ([fieldName|subformName|formName].execValidate())

     {

          do stuff;

     }

else

     {

          don't do stuff;

     }

To get deeper into it, there are some exellent posts and script objects on the FormFeed blog:

http://blogs.adobe.com/formfeed/2008/11/validation_patterns_part_1.html

http://blogs.adobe.com/formfeed/2008/11/validation_patterns_part_2.html

http://blogs.adobe.com/formfeed/2008/11/validation_patterns_part_3.html

If you do go down this road, the latest version of the supplied scripts are in the following post:

http://blogs.adobe.com/formfeed/2009/03/a_form_to_design_a_form.html