These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

How to modify date/time field

PITTfan2
Registered: Sep 5 2009
Posts: 14

Can a date/time field be modified to highlight specific dates? I found a javascript but am having difficulty modifying it for LiveCycle Designer.

cal2.eventDates = new Array(
new Array("2005/2/10", 1)
, new Array("2005/2/12", 2)
, new Array("2005/2/14", 3)
);

I would like to add on-click functionality to the event dates, and found this event which adds a function to the selectEvent stub:

cal2.selectEvent = function(eventId) {alert("cal2 Event: " + eventId);};

How can I modify these to work in LiveCycle Designer?

My Product Information:
LiveCycle Designer, Windows
radzmar
Expert
Registered: Nov 3 2008
Posts: 1202
You can use formcalc to highlight specific dates.
Therefore you place a hidden textfield in your form and add an script like this into its calculate event.

//Create a formatted variable from the date fieldvar CheckDates = Num2Date(Date2Num(DatumsUhrzeitfeldVon.formattedValue, DateFmt(2)), "DD.MM.YYYY") //check if the variable has the same value as the dates you wish to highlight//if the value is the same then set the color to red, else to blackif (CheckDates == "03.10.2009") thenDatumsUhrzeitfeldVon.font.fill.color.value = "255,0,0"elseif (CheckDates == "06.12.2009") thenDatumsUhrzeitfeldVon.font.fill.color.value = "255,0,0"elseif (CheckDates == "24.12.2009") thenDatumsUhrzeitfeldVon.font.fill.color.value = "255,0,0"elseif (CheckDates == "31.12.2009") thenDatumsUhrzeitfeldVon.font.fill.color.value = "255,0,0"elseDatumsUhrzeitfeldVon.font.fill.color.value = "0,0,0"endif

An working example can be find here:
https://share.acrobat.com/adc/document.do?docid=f2a0434c-35b5-4251-aacf-161bf9a8c40d

radzmar
LoveCycle Blog
Documents you need:
LiveCycle Designer ES2 Docs

willin2u
Registered: Sep 14 2009
Posts: 16
The script does not recognize "DatumsUhrzeitfeldVon". Should I be putting something else in place of this?
radzmar
Expert
Registered: Nov 3 2008
Posts: 1202
Have you look into the sample form?
there is everything you want.

Download and open it in LCD.
There is a hidden field, right to the first date field, which is doing all the calculations for highlighting dates.
You may have customize the script to your needs (fieldnames), but generally it's the same.

radzmar
LoveCycle Blog
Documents you need:
LiveCycle Designer ES2 Docs