Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

Help with Script

Avatar

Level 7

Hi everyone!

Here is my problem..

Department field is a required field into a hidden subform (form1.Page1.REPLACEMENT_SUB).

The problem it is when I click the email button it's ask me to fill in

the above field(Department)!

I have a DDList with two item (Employee Name,Department).

The Department field becomes available(visible) if I select Department from DDL.

Please help!

Here is my variable:

function Ex1ValidFields()

{

   var bRtn = false;

   var aErrMsg = [];

   var rgEmpty = /^\s*$/;

if((form1.Page1.Section_A.EmployeeName.rawValue == null) || rgEmpty.test(form1.Page1.Section_A.EmployeeName.rawValue))

      aErrMsg.push("Employee Name");

     

if(( form1.Page1.REPLACEMENT_SUB.Department.rawValue == null) || rgEmpty.test(form1.Page1.REPLACEMENT_SUB.Department.rawValue))

      aErrMsg.push("Department Name");

     

if(aErrMsg.length == 0)

      bRtn = true;

 

      else

      app.alert("One or more required fields have not been filled out:\n\n   * " + aErrMsg.join("\n   * "),4);;

  1. xfa.host.currentPage = 0;

   return bRtn;

   }

For email button on click event I have the script below:

if(Init.Ex1ValidFields())

var myDoc = event.target;    

var address = "aaa@bbb.org";

var sub = "Staffing Req - ";    

var Sender =(form1.Page1.Section_A.EmployeeInfo.Row1.PositionTitle.rawValue);    

var msgBody = "See my Form attached.\n\nThank You!";

  1. myDoc.mailDoc({ bUI: false,        

cTo: address,

cSubject: sub + Sender,        

cMsg: msgBody + "\n\nRegards\n",        

cSubmitAs: "PDF"});

8 Replies

Avatar

Level 10

Hi,

The script that changes the presence of the REPLACEMENT_SUB subform, should also set the mandatory property of the dropdown. See an example here: http://assure.ly/hxHupW.

Hope that helps,

Niall

Avatar

Level 7

Hi Nial,

I  can not make it to work!!!!

Is it posible to have a litle more help with the exit script for the DDList and what will be the binding values according

to your sample provided?

Thank you

Avatar

Level 10

Hi,

It would be easier if you could share the form. I'll get to it when I can.

Niall

Avatar

Level 7

Hi Nial,

I have upload the form: https://acrobat.com/app.html#o

Thank you very much

Avatar

Level 10

You have posted the URL to the service and not the URL of the actual file. Log back on; publish the file; and then copy the URL for the published file.

Thanks,

Niall

Avatar

Level 10

Hi,

You need to publish the file to allow people to access it. Log back into Acrobat.com, select the file and then in the lower left click Share File and then Publish.

Niall

Avatar

Level 7

here is my file:

https://acrobat.com/#d=jqF1EDVB0j5kdojAOi9dCQ

With thw DDlist I control visible and hidden subforms with MANDATORY AND NON MANDATORY FIELDS.

Also in a change event with a script I try to make mandatory field to become non mandatory in case

subform is hidden and vice versa!

But the The variable script seems to override the change event script!

With the variable script(Joseph) I inform user for missing entering data into specific field.

How I will make the variable script9Joseph) to work?

I need to indicate user where exactly there is missing data.

Thank you