PDF-Forms is a service provided by PDFzone.com | http://www.pdfzone.com/
__________________________________________________________________

Hello List

I use the script below to check for required fields on my form. The form is
created with some fields that are always visible (some of the always visible
fields are at the top of the form, and a few are at the bottom. In between
the always visible fields are three groups of fields that are conditionally
visible. That is, if the user clicks on a check box, then the fields
associated with that check box become visible and are then required and
should be filled out by the user.

My script below does a fine job of checking the visible required fields, but
when it gets to the first check box (f12) the script stops checking the
fields. The other check boxes that reveal additional fields are f17 and f23.

Thanks in advance for any ideas on this

Kenn


var cViewer = "Reader";
var nWarning = 1;
var cMsg1 = "Since you are using Acrobat Reader to fill out this form, you
won't be able to save or email it.";
var cMsg2 = "In order to save or email forms, you must use either Acrobat
Approval, or the full version of Acrobat software.";
// If Reader is being used, display message telling user that "Email" and
"Save Data" buttons don't work.
if (app.viewerType ==  cViewer)
 app.alert(cMsg1 +  cMsg2, nWarning);
else {
 f1 = this.getField("ad_no");
 f2 = this.getField("ad_desc");
 f3 = this.getField("type_1");
 f4 = this.getField("run_date");
 f5 = this.getField("cbogmm_spon");
 f6 = this.getField("cbodmm_spon");
 f7 = this.getField("cbodept_spon");
 f8 = this.getField("cbodmm_finan_spon");
 f9 = this.getField("tbx_coop_dmm");
 f10 = this.getField("tbx_load_dmm");
 f11 = this.getField("tbx_amnt_dmm");
 f12 = this.getField("Check_Box_dmm_2");
 f13 = this.getField("cbodmm_2_finan_spon");
 f14 = this.getField("tbx_coop_dmm_2");
 f15 = this.getField("tbx_load_dmm_2");
 f16 = this.getField("tbx_amnt_dmm_2");
 f17 = this.getField("Check_Box_dmm_3");
 f18 = this.getField("cbodmm_3_finan_spon");
 f19 = this.getField("tbx_coop_dmm_3");
 f20 = this.getField("tbx_load_dmm_3");
 f21 = this.getField("tbx_amnt_dmm_3");
 f22 = this.getField("notes")
 f23 = this.getField("view_promag");
 f24 = this.getField("mag_pub_name");
 f25 = this.getField("mag_art_due");
 f26 = this.getField("mag_shipping");
 f27 = this.getField("spec_trim");
 f28 = this.getField("spec_live");
 f29 = this.getField("spec_bleed");
 f30 = this.getField("mag_contact");
 f31 = this.getField("mag_market");
 f32 = this.getField("mag_color");
 f33 = this.getField("req_by");
 f34 = this.getField("ad_coord");

          if (f1.value == "")
   {app.alert ('Please enter an ad number or type "TBD".');
          if (typeof app.formsVersion != "undefined" && app.formsVersion >=
4.0)
          // Version specific operation:
          f1.setFocus();}
  else if (f2.value == "")
   {app.alert ('Please enter an Ad Description.');
   if (typeof app.formsVersion != "undefined" && app.formsVersion >= 4.0)
          // Version specific operation:
          f2.setFocus();}
            else if (f3.value == "Click to Select")
   {app.alert ('Please specify the type of request you are submitting.');
          if (typeof app.formsVersion != "undefined" && app.formsVersion >=
4.0)
          // Version specific operation:
          f3.setFocus();}
  else if (f4.value == "")
   {app.alert ('Please enter a run date or type "TBD"');
          if (typeof app.formsVersion != "undefined" && app.formsVersion >=
4.0)
          // Version specific operation:
          f4.setFocus();}
  else if (f5.value == "_Click to Select a GMM" && f6.value == "_Click to
Select a DMM" && f7.value == "_Click to Select a Department")
   {app.alert ('Please select an Ad Sponsor.');
          if (typeof app.formsVersion != "undefined" && app.formsVersion >=
4.0)
          // Version specific operation:
          f5.setFocus();}
  else if (f8.value == "_Click to Select a DMM")
   {app.alert ('Please select a DMM Financial Sponsor.');
          if (typeof app.formsVersion != "undefined" && app.formsVersion >=
4.0)
          // Version specific operation:
          f8.setFocus();}
  else if (f9.value == "Enter a dollar amount or percent.")
   {app.alert ('Please enter a coop amount. If 0, please type zero or
none.');
          if (typeof app.formsVersion != "undefined" && app.formsVersion >=
4.0)
          // Version specific operation:
          f9.setFocus();}
  else if (f10.value == "Enter a dollar amount.")
   {app.alert ('Please enter a load amount. If 0, please type zero or
none.');
          if (typeof app.formsVersion != "undefined" && app.formsVersion >=
4.0)
          // Version specific operation:
          f10.setFocus();}
                else if (f12.value == 'Yes' )  {
     if (f13.value == "_Click to Select a DMM")
   {app.alert ('Please select a DMM Financial Sponsor.');
          if (typeof app.formsVersion != "undefined" && app.formsVersion >=
4.0)
          // Version specific operation:
          f13.setFocus();}
  else if (f14.value == "Enter a dollar amount or percent.")
   {app.alert ('Please enter a coop amount. If 0, please type zero or
none.');
          if (typeof app.formsVersion != "undefined" && app.formsVersion >=
4.0)
          // Version specific operation:
          f14.setFocus();}
  else if (f15.value == "Enter a dollar amount.")
   {app.alert ('Please enter a load amount. If 0, please type zero or
none.');
          if (typeof app.formsVersion != "undefined" && app.formsVersion >=
4.0)
          // Version specific operation:
          f15.setFocus();}
  else if (f11.value == "If shared, enter $ or % of portion.")
   {app.alert ('If shared, indicate what amount is shared.');
          if (typeof app.formsVersion != "undefined" && app.formsVersion >=
4.0)
          // Version specific operation:
          f11.setFocus();}
  else if (f16.value == "If shared, enter $ or % of portion.")
   {app.alert ('If shared, indicate what amount is shared.');
          if (typeof app.formsVersion != "undefined" && app.formsVersion >=
4.0)
          // Version specific operation:
          f16.setFocus();}
       }
                else if (f17.value == 'Yes' )  {
       if (f18.value == "_Click to Select a DMM")
   {app.alert ('Please select a DMM Financial Sponsor.');
          if (typeof app.formsVersion != "undefined" && app.formsVersion >=
4.0)
          // Version specific operation:
          f18.setFocus();}
  else if (f19.value == "Enter a dollar amount or percent.")
   {app.alert ('Please enter a coop amount. If 0, please type zero or
none.');
          if (typeof app.formsVersion != "undefined" && app.formsVersion >=
4.0)
          // Version specific operation:
          f19.setFocus();}
  else if (f20.value == "Enter a dollar amount.")
   {app.alert ('Please enter a load amount. If 0, please type zero or
none.');
          if (typeof app.formsVersion != "undefined" && app.formsVersion >=
4.0)
          // Version specific operation:
          f20.setFocus();}
  else if (f21.value == "If shared, enter $ or % of portion.")
   {app.alert ('If shared, indicate what amount is shared.');
          if (typeof app.formsVersion != "undefined" && app.formsVersion >=
4.0)
          // Version specific operation:
          f21.setFocus();}
   }
  else if (f23.value == 'Yes' )  {
   if (f24.value == "Choose a Publication")
    {app.alert ('Please go to the Magazine/Special Publication section and
enter the name of the publication.');
          if (typeof app.formsVersion != "undefined" && app.formsVersion >=
4.0)
          // Version specific operation:
          f24.setFocus();}
  else if (f25.value == "")
    {app.alert ('Please go to the Magazine/Special Publication section and
enter an artwork due date.');
          if (typeof app.formsVersion != "undefined" && app.formsVersion >=
4.0)
          // Version specific operation:
          f25.setFocus();}
   else if (f26.value == "")
    {app.alert ('Please go to the Magazine/Special Publication and enter a
shipping method.');
          if (typeof app.formsVersion != "undefined" && app.formsVersion >=
4.0)
          // Version specific operation:
          f26.setFocus();}
   else if (f27.value == "")
    {app.alert ('Please go to the Magazine/Special Publication section and
enter a trim size.');
          if (typeof app.formsVersion != "undefined" && app.formsVersion >=
4.0)
          // Version specific operation:
          f27.setFocus();}
   else if (f28.value == "")
    {app.alert ('Please go to the Magazine/Special Publication section and
enter the "live" size.');
          if (typeof app.formsVersion != "undefined" && app.formsVersion >=
4.0)
          // Version specific operation:
          f28.setFocus();}
   else if (f29.value == "")
    {app.alert ('Please go to the Magazine/Special Publication section and
enter the "bleed" size.');
          if (typeof app.formsVersion != "undefined" && app.formsVersion >=
4.0)
          // Version specific operation:
          f29.setFocus();}
   else if (f30.value == "Name, phone, email of Pub Contact")
    {app.alert ('Please go to the Magazine/Special Publication section and
enter \n the name and phone number/email address of a contact at the
publication.');
          if (typeof app.formsVersion != "undefined" && app.formsVersion >=
4.0)
          // Version specific operation:
          f30.setFocus();}
   else if (f31.value == "Market/Specify Store Logo")
    {app.alert ('Please go to the Magazine/Special Publication section and
enter \n the markets and cps nameplate (store) logos required for this
ad.');
          if (typeof app.formsVersion != "undefined" && app.formsVersion >=
4.0)
          // Version specific operation:
          f31.setFocus();}
   else if (f32.value == "")
    {app.alert ('Please go to the Magazine/Special Publication section and
enter the color.');
          if (typeof app.formsVersion != "undefined" && app.formsVersion >=
4.0)
          // Version specific operation:
          f32.setFocus();}
   else if (f22.value == "Notes: ")
           {app.alert ('Please go to the "Notes" box and indicate the size
fo this ad, for example: full page, 1/2 page, 1/4 page, etc.');
          if (typeof app.formsVersion != "undefined" && app.formsVersion >=
4.0)
          // Version specific operation:
          f22.setFocus();}
                        else if (f33.value == "")
    {app.alert ('The "Requested by" line cannot be blank. Please type the
name of the person requesting this ad.');
          if (typeof app.formsVersion != "undefined" && app.formsVersion >=
4.0)
          // Version specific operation:
          f33.setFocus();}
   else if (f34.value == "Click to Select")
    {app.alert ('Please specify who approved this request.');
   if (typeof app.formsVersion != "undefined" && app.formsVersion >= 4.0)
          // Version specific operation:
          f34.setFocus();}
            else
    // Email form and data.
    this.mailDoc(true, "[EMAIL PROTECTED]", "", "", "Request Form
Submission");

  }
  else if (f33.value == "")
   {app.alert ('The "Requested by" line cannot be blank. Please type the
name of the person requesting this ad.');
          if (typeof app.formsVersion != "undefined" && app.formsVersion >=
4.0)
          // Version specific operation:
          f33.setFocus();}
  else if (f34.value == "Click to Select")
   {app.alert ('Please specify who approved this request.');
          if (typeof app.formsVersion != "undefined" && app.formsVersion >=
4.0)
          // Version specific operation:
          f34.setFocus();}
else
   // Email form and data.
   this.mailDoc(true, "[EMAIL PROTECTED]", "", "", "Request Form
Submission");}



To change your subscription:
http://www.pdfzone.com/discussions/lists-pdfforms.html

Reply via email to