Expand my Community achievements bar.

SOLVED

Livecycle Mandatory Field based on data entry of another Field

Avatar

Level 1

Hello All,

 

I am very new to forms (this is my first post in the community) and found that the company had a license for Acrobat 8 Pro which can with a copy of  Livecycle.  I have used a pdf of a deal sheet and have inserted all the relevant fields, tab orders etc.  I realise that Livecycle is out of date, but i need to show the benefit of forms before they will agree to a license for another product.

 

I would like to make a Numeric field (Aretail) mandatory based on whether another Numeric Field (Apex) contains data.  So if there is no data in Apex field the Aretail field is not required to be mandatory, if  there is data in Apex field the Aretail field is required to be mandatory before allowing the email submit.

 

I have found many scripts on the web and have had a little success with  the following and have written the script in the validate event for the Aretail field (i have no idea if that is correct event to be in but it seems to work to an extent)

 

if  (Apex.rawValue==null)

{

Aretail.mandatory = "disabled";

}

else

{

Aretail.mandatory = "error";

}

 

This has the desired effect except for when I move out of the Aretail numeric field, or try to submit the form via the submit email button, I get the error popup  "Aretail validate failed."

 

Numeric fields have a pattern set to $zzz,zz9.99, the value tab in objects has no validation pattern set, but the error still remains when i set the validation pattern to the same as the numeric field.

 

Any help would be greatly appreciated, as this is the only thing stopping me from releasing the form for use.

 

Thank you

1 Accepted Solution

Avatar

Correct answer by
Employee

Hi

forget what you do at the moment and change as follows:

kprokopi_0-1594645514213.png

2 numeric fields APEX and ARETAIL both NOT mandatory and no other validations! When APEX is left empty (rawValue==null) then the retail field can also be left empty. Submit as Email is a good way to submit in Designer Preview.

Change the preSubmit event of ARETAIL ONLY:

kprokopi_1-1594645677092.png

This is how it works:

APEX empty and ARETAIL empty - you can submit (same when ARETAIL is filled)

kprokopi_2-1594645754058.png

APEX filled and ARETAIL not:

kprokopi_3-1594645794052.png

Once you provided a value then Submit goes ahead

kprokopi_4-1594645837117.png

 

View solution in original post

3 Replies

Avatar

Community Advisor

Hi,

It seems this question is not related to AEM product. Could you please move/create this question in respective community forum, so that respective experts can have a look.



Arun Patidar

Avatar

Administrator

Moved this question to the relevant topic.



Kautuk Sahni

Avatar

Correct answer by
Employee

Hi

forget what you do at the moment and change as follows:

kprokopi_0-1594645514213.png

2 numeric fields APEX and ARETAIL both NOT mandatory and no other validations! When APEX is left empty (rawValue==null) then the retail field can also be left empty. Submit as Email is a good way to submit in Designer Preview.

Change the preSubmit event of ARETAIL ONLY:

kprokopi_1-1594645677092.png

This is how it works:

APEX empty and ARETAIL empty - you can submit (same when ARETAIL is filled)

kprokopi_2-1594645754058.png

APEX filled and ARETAIL not:

kprokopi_3-1594645794052.png

Once you provided a value then Submit goes ahead

kprokopi_4-1594645837117.png