Greetings,
I am working w/ Adobe 6 & 7 and I am a novice programmer in Adobe although I have programmed in other languages.
I am trying to write a quick javascript that will take the data from three date fields; d-2 digit text field, m-2 digit drop down, y-4 digit text field and combine them into one text field. I was trying to keep it simple since we are using multiple versions of Adobe.
I added this code first to the Year field and then to a button but neither is working. I added a few alerts and found even though the three fields are not == 0 1st part of the code is partially executing, i.e. app.alert("MVRHEADER.VSTDTD") pops up but the field is not set to NONE. In truth the ELSE should execute instead anyway. I seem to have multipe problems.
Can anyone help and/or direct me to an example?
Thank you,
Valerie
var xVSTDTD = this.getField("MVRHEADER.VSTDTD");
var xVSTDTM = this.getField("MVRHEADER.VSTDTM");
var xVSTDTY = this.getField("MVRHEADER.VSTDTY");
var xVSTDT = this.getField("MVRHEADER.VSTDT");
if ((xVSTDTD.value.length == 0) || (xVSTDTM.value.length == 0) || (xVSTDTY.value.length == 0))
{
app.alert("MVRHEADER.VSTDTD");
xVSTDT = "NONE";
}
else
{
app.alert("In the else");
xVSTDT = xVSTDTD;
}
// Get field references
var xVSTDTD = getField("MVRHEADER.VSTDTD");
var xVSTDTM = getField("MVRHEADER.VSTDTM");
var xVSTDTY = getField("MVRHEADER.VSTDTY");
if ((xVSTDTD.value == "") || (xVSTDTM.value == "") || (xVSTDTY.value == "")) {
app.alert("MVRHEADER.VSTDTD");
// Set this field value
event.value = "NONE";
} else {
app.alert("In the else");
// Set this field value by concatenating d, m, y, with a "/" separator
event.value = xVSTDTD.value + "/" + xVSTDTM.value + "/" + xVSTDTY.value
}
This may not be exactly what you need, but it should get you started.
George