Quantcast
Channel: Adobe Community : All Content - LiveCycle Designer
Viewing all articles
Browse latest Browse all 5571

How to make field mandatory based on condition and concating dates

$
0
0


Hi I am currently trying to accomplish a few things using adobe live cycle and java script.  I am in need of assitance and would be very greatful for any help.  I have provided the scenario below.

 

A user enters a date into a pdf fillable form by entering information into 6 text fields.  One text field for the 4 digits of the year e.g. 2015 and 2 for the month e.g. 09 (September).  I would like to make another field textfield Y be mandatory if the date (the one with the 6 text boxes) -todays date <1865 days.  Please note I am not able to change the form design unfortunately.    In order to help I have provided a little more detail below.

 

Lets say a user has a date of Sep 15, 2015 then they enter 2 in one text field, 0 in another, 1 in another, 5 in another, 0 in another and 9 in the last field.  The rule is if today's date-that date they entered is less than 5 years they must provide additional information.

 

I have concated the the 6 text fields to construct a date that is "YYYY-MM" and have tried to put in the rule but  the dates are not being read properly.  Any help would be much appreciated.  Some of my code is below.

 

To re-recreat the date I created a text field and using form calc on calculate event. M2R =the second month digit

 

 

if (M2R.rawValue nenull)

then

 

 

$.formattedValue

= (CONCAT(Y1R,Y2R,Y3R,Y4R,"-",M1R,M2R))

 

To capture the date for today I simply use this code in another text box

 

$.rawValue

= Num2Date(Date(), "MMM-YY")

 

To get the difference I take I simply create a new variable =Concatted date-today's date in milliseconds, then convert it into days into a variable called days.  I try to capture this in a numerfic field. 

 

To set mandatory field I say fieldname.mandatory=(days.rawvalue<1865)?"error:"disabled"


Viewing all articles
Browse latest Browse all 5571

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>