Expand my Community achievements bar.

Javascript Help (days between dates)

Avatar

Former Community Member

Hi everyone,

I really need help with setting up my form.

My form is a staff rental car application form.

What it does is

1) Select a Car

2) Choose the pickup & dropoff dates  (if it is on the same day it's counted as 1 day)

3) Depending on the number of days there will be a different price that will show up in cost.

i have used the purchase order example that comes with Livecycle ES 8.2 to auto populate my fields(Javascript). in this case the COST field. then i can just use simple formcalc to calculate the total.

My current problem is that i can't calculate days between dates in JS. I've tried calculating in formcalc and trying to "grab" the result into a JS but still can't get it to work.

Is anyone able to help me with the date calculation so that i can pass it into my getdescription function as a variable for a IF statement.

i have attached a link to my file

http://www.bses.org.au/downloads/Steven_IT/TravelWorkout2.pdf

the extra boxes outside of the table are jsut testing cells, so i could see what was returning.

I would be greatful if anyone has any suggestions for me in how to integrate the date manipulation.

1 Reply

Avatar

Level 4

How about a workaround?

You said you already calculated it in Formcalc.

Why don't you make an invisible field with the Formcalc calculation and just import that value into javascript?

Another way would be to make f.ex. if statements in formcalc.

(Little formcalc if structure... to show how it works:

if (Kontrollkästchen4 == 1)  then this.presence ="hidden" else this.presence = "visible" endif

)