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

Output Birth from DOB field

$
0
0

Hello,

 

I used a script for a previous project a year ago in LiveCycle and it worked perfect but I have lost that file/script and not sure of the script to use  I went ahead and copied the DOB field and text field into seperate PDF to see if you can tell me where I am going wrong at please.  I am not seeing any errors when I do syntax check.

 

Here is link to file

http://www.41global.com/test.pdf

 

Here is link to previous project that is working:

http://www.41global.com/screen.jpg

 

Script being used:

event.value = "";

var dobValue = getField("DOB").value;

if (dobValue!="") {

    var dob = util.scand("mm/dd/yyyy", dobValue);

    var today = new Date();

    var age = today.getFullYear() - dob.getFullYear() - 1;

    if (today.getMonth()>dob.getMonth()) {

        age++;

    } else if (today.getMonth()==dob.getMonth()) {

        if (today.getDate()>dob.getDate())

            age++;

    }

    event.value = age;

}

 

Thanks so much in advance


Viewing all articles
Browse latest Browse all 5571

Trending Articles



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