Previous | Next | (P-PDF) JavaScript
Topic: Check if my javascript is correct!!
Conf: (P-PDF) JavaScript, Msg: 28820
From: Brian3012
Date: 10/20/2001 04:47 AM
Hi,
I am making a form that has a scolldown button, but when I print out the form the text is no present. Also, I keep getting a message in the console that says
uncaught exception:Field cmblockers_1:Focus:6: Operation failed in Global.setPersistent.
uncaught exception:Field cmbparkspace_1:Focus:6: Operation failed in Global.setPersistent.
uncaught exception:Field cmbirrev_v_p:Focus:6: Operation failed in Global.setPersistent.
uncaught exception:Field cmbp_complete_d:Focus:6: Operation failed in Global.setPersistent.
uncaught exception:Field cmbp_irrev_d:Focus:6: Operation failed in Global.setPersistent.
uncaught exception:Field cmbp_complete_m:Focus:6: Operation failed in Global.setPersistent.
uncaught exception:Field cmbp_irrev_m:Focus:6: Operation failed in Global.setPersistent.
uncaught exception:Field cmbp_req_m:Focus:6: Operation failed in Global.setPersistent.
uncaught exception:Field cmbp_req_d:Focus:6: Operation failed in Global.setPersistent.
uncaught exception:Field cmbp_exec_m:Focus:6: Operation failed in Global.setPersistent.
uncaught exception:Field cmbackvenpur_2:Focus:6: Operation failed in Global.setPersistent.
uncaught exception:Field cmbackvenpur_1:Focus:6: Operation failed in Global.setPersistent.
uncaught exception:Field cmbp_req_m:Focus:79: Operation failed in Global.setPersistent.
uncaught exception:Field cmbp_req_d:Focus:79: Operation failed in Global.setPersistent.
uncaught exception:Field cmbackvenpur_1:Focus:79: Operation failed in Global.setPersistent.
uncaught exception:Field cmbdatedat1_m:Focus:79: Operation failed in Global.setPersistent.
Can someone please help me find a bug in my javascript?
global.nosave=0;
function AutoTab(doc, event, cNext)
{
if (typeof app.formsVersion == "undefined" || app.formsVersion < 4.05)
return;
// Call the built-in routine to allow numbers only.
//AFNumber_Keystroke(0, 0, 0, 0, "", true);
// If we've filled in the field completely, jump to the next one.
if (event.rc && AFMergeChange(event).length == event.target.charLimit)
doc.getField(cNext).setFocus();
}
function SetBlurName()
{
if (typeof app.formsVersion == "undefined" || app.formsVersion < 4.05)
return;
if (global.typefield == 1)
{
if(global.focus == 1)
{
global.PastFieldName=global.CurFieldName;
global.focus = 0;
}
else
{
global.focus = 1;
}
}
else
global.PastFieldName=global.CurFieldName;
}
function SetFocusName(event)
{
if (typeof app.formsVersion == "undefined" || app.formsVersion < 4.05)
return;
var f = event.target;
global.setPersistent("CurFieldName", true);
global.setPersistent("PastFieldName", true);
global.CurFieldName=event.target.name;
if (event.target.doc.getField(global.CurFieldName).type == "text")
{
global.typefield = 1;
if(global.focus == 1)
{
if(event.target.doc.getField(global.PastFieldName) )
{
if (event.target.doc.getField(global.PastFieldName).type == "text" || event.target.doc.getField(global.PastFieldName).type == "combobox" || event.target.doc.getField(global.PastFieldName).type == "listbox")
{
if ( event.target.doc.getField(global.PastFieldName).multiline && event.target.doc.getField(global.PastFieldName).value != "" )
event.target.doc.getField(global.PastFieldName).fillColor = color.white;
else
event.target.doc.getField(global.PastFieldName).fillColor = color.transparent;
}
if (event.target.doc.getField(global.PastFieldName).type != "text" && event.target.doc.getField(global.PastFieldName).type != "combobox" && event.target.doc.getField(global.PastFieldName).type != "listbox")
{
if ( event.target.doc.getField(global.PastFieldName).type == "button")
event.target.doc.getField(global.PastFieldName).strokeColor = color.black;
else
event.target.doc.getField(global.PastFieldName).strokeColor = color.transparent;
}
}
if (event.target.doc.getField(global.CurFieldName).type != "text" && event.target.doc.getField(global.CurFieldName).type != "combobox" && event.target.doc.getField(global.CurFieldName).type != "listbox")
event.target.doc.getField(global.CurFieldName).strokeColor = color.cyan;
if (event.target.doc.getField(global.CurFieldName).type == "text" || event.target.doc.getField(global.CurFieldName).type == "combobox" || event.target.doc.getField(global.CurFieldName).type == "listbox")
event.target.doc.getField(global.CurFieldName).fillColor = color.cyan;
if((global.PastFieldName != global.CurFieldName) && (f.type == "text"))
event.target.doc.getField(global.CurFieldName).setFocus();
if (event.target.doc.getField(global.CurFieldName).type == "combobox" || event.target.doc.getField(global.CurFieldName).type == "listbox")
global.PastFieldName = global.CurFieldName;
}
}
else
{
global.typefield = 0;
var oldName = this.getField(global.PastFieldName);
if(oldName)
{
if (oldName.type == "text" || oldName.type == "combobox" || oldName.type == "listbox")
{
if ( oldName.multiline && oldName.value != "" )
oldName.fillColor = color.white;
else
oldName.fillColor = color.transparent;
}
if (oldName.type != "text" && oldName.type != "combobox" && oldName.type != "listbox")
{
if ( oldName.type == "button")
oldName.strokeColor = color.black;
else
oldName.strokeColor = color.transparent;
}
}
if (f.type != "text" && f.type != "combobox" && f.type != "listbox")
f.strokeColor = color.cyan;
if (f.type == "text" || f.type == "combobox" || f.type == "listbox")
f.fillColor = color.cyan;
if (f.type == "combobox" || f.type == "listbox")
global.PastFieldName = global.CurFieldName;
}
}
aTens = [ "Twenty", "Thirty", "Forty", "Fifty", "Sixty", "Seventy", "Eighty", "Ninety"];
aOnes = [ "Zero", "One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine",
"Ten", "Eleven", "Twelve", "Thirteen", "Fourteen", "Fifteen", "Sixteen", "Seventeen", "Eighteen",
"Nineteen" ];
function ConvertToHundreds(num)
{
var cNum, nNum;
var cWords = "";
num %= 1000;
if (num > 99) {
/* Hundreds. */
cNum = String(num);
nNum = Number(cNum.charAt(0));
cWords += aOnes[nNum] + " Hundred";
num %= 100;
if (num > 0)
cWords += " and "
}
if (num > 19) {
/* Tens. */
cNum = String(num);
nNum = Number(cNum.charAt(0));
cWords += aTens[nNum - 2];
num %= 10;
if (num > 0)
cWords += "-";
}
if (num > 0) {
/* Ones and teens. */
nNum = Math.floor(num);
cWords += aOnes[nNum];
}
return cWords;
}
function ConvertToWords(num)
{
var aUnits = [ "Thousand", "Million", "Billion", "Trillion", "Quadrillion" ];
var cWords = (num >= 1 && num < 2) ? "Dollar and " : "Dollars and ";
var nLeft = Math.floor(num);
if(num == 0)
{
cWords = "";
return cWords;
}
for (var i = 0; nLeft > 0; i++) {
if (nLeft % 1000 > 0) {
if (i != 0)
cWords = ConvertToHundreds(nLeft) + " " + aUnits[i - 1] + " " + cWords;
else
cWords = ConvertToHundreds(nLeft) + " " + cWords;
}
nLeft = Math.floor(nLeft / 1000);
}
num = Math.round(num * 100) % 100;
if (num > 0)
cWords += ConvertToHundreds(num) + " Cents";
else
cWords += "Zero Cents";
return cWords;
}