Hi, Before I switched over to lifecycle, I created a simple function for date entry edits. This function had 2 purposes;
A. take a full date and convert it to the DDMMMYYYY format AND
B. take a partial date and convert it to the MMMYYYY format.
I don't know if there is an easy way to do that without functions, but i have been playing around with lifecycle for a few hours now, with no results. This function did work with Acrobate PRO 8. I am not sure if the code would work with lifecycle and i am either further confused on how to call a function in lifecycle.
I'm sure this function could be done a heck of a lot easier, and with less work, but I havn't written code in about...4 years, so getting back into it is tough (and even then it was C# and ColdFusion)
var fieldValue= event.value;
var myArray = fieldValue.split("/");
var monthName= new Array("JAN","FEB","MAR","APR","MAY","JUN","JUL","AUG","SEP","OCT","NOV","DEC");
myArray = monthName[myArray-1];
//----end Variable assignment
//----set year prefix to '20' if last two didgets are less then 16----
In XFA forms you can create a scripting object (that is where you shodul put your code). Then you can call your function by using the scripting object name.functionname()
event.value is the value inside the box once changed.. i think it becomes 'name'.rawValue in XFA.
Scripting object was created, i may have been calling the function incorrectly, i was just using functionname(). i'll play around some more and see what happens. thank you
The equivalent function in XFA is fieldname.event.newText
cool. i'll try using that. At the same time, I think i'm calling the function incorrectly still.
I tried this.fixdate(), datebox1.fixDate(), datebox1.fixdate(this.rawvalue), and a few other combinations of those to try and get it working. To test, i just made a simple function that i know works, but it isn't getting called.
In the heirarchy view ...right click on the root object (usually it is form1). Choose the "Insert Script Object" option. It will put an object called "Script Object" under the variables portion of the tree.
Highlight the script object in the hierarchy and hit F2 to rename it. Call it what you want (I will use myScriptObject). With the new script object highlighted the Script editor will show you what is in your script object. Paste your function in there (note that you cannot choose an event). Now your function is ready to use.
When you want to call it you woudl use:
yea, for some reason I still can't call the function, if I copy and paste the code into the actual date/time box, it works fine, but using
fixDate.fixdate() in the box doesn't seem to want to call the function.
ok... apparently, the script object CANNOT be the same name as the Function. that's where I was hitting an issue. Thank you again for the help.