Component SET_190_SCRIPT
<SCRIPT LANGUAGE="JavaScript"> <!--
function SetButton(btnvalue)
{
document.LANSA._BUTTON.value = btnvalue;
}
function HandleSubmit()
{
document.LANSA.submit();
}
function pathOnly(InString)
{
LastSlash=InString.lastIndexOf('/',InString.length-1);
OutString=InString.substring(0,LastSlash+1);
return(OutString);
}
function GetHelp()
{
if (document.LANSA._NAME.value != "&NULL")
{
var ref = pathOnly(location.href);
var lweb = "LANSAWEB?FUNCHELP+<RDML MERGE="&SESSION">+";
var opt = "width=350,height=425,directories=no,toolbar=no,";
var win;
opt += "menubar=no,scrollbars=yes,resizable=yes";
ref += lweb;
ref += document.LANSA._NAME.value;
win = window.open(ref,"lansahelp", opt);
}
}
function GetExtraInfo(ListName, EntryNum, Field1, Field2, Field3, Field4, Field5)
{
var ref = pathOnly(location.href);
var lweb = "LANSAWEB?FLDCONT+<RDML MERGE="&SESSION">+";
var opt = "width=350,height=425,directories=no,toolbar=no,";
var win;
opt += "menubar=no,scrollbars=yes,resizable=yes";
ref += lweb+EntryNum + "+" + ListName;
if (Field1 != '&NULL')
{
ref += "+" + Field1;
if (Field2 != '&NULL')
{
ref += "+" + Field2;
if (Field3 != '&NULL')
{
ref += "+" + Field3;
if (Field4 != '&NULL')
ref += "+" + Field4;
if (Field5 != '&NULL')
{
ref += "+" + Field5;
}
}
}
}
}
win = window.open(ref,"lansahelp", opt);
}
function SetSelect(HTMLName, Name,Row,Column,Select)
{
document.LANSA._SELECT.value=Select;
SetNameLocation(Name,Row,Column);
document.LANSA._CALFLD.value=HTMLName;
return;
}
function SetNameLocation(Name,Row,Column)
{
document.LANSA._NAME.value=Name;
document.LANSA._ROW.value=Row;
document.LANSA._COLUMN.value=Column;
document.LANSA._CALFLD.value=Name;
return;
}
function CallCalendar()
{
if (document.LANSA._CALFLD.value != "&NULL")
{
var opt = "width=340,height=385,directories=no,toolbar=no,";
opt += "menubar=no,scrollbars=no,resizable=yes";
win = window.open("/images/lcalen.htm", "calendar", opt);
win.opener=window;
}
}
function SetDate(day, month, year)
{
var Field=document.LANSA._CALFLD.value;
if (year < 2000)
{
YearRet=year-1900;
}
else
{
YearRet=year-2000;
}
var RDate=day+"/"+month+"/";
if (YearRet<10)
RDate+="0"+YearRet;
else
RDate+=YearRet;
var NumElements=document.LANSA.elements.length;
for (i=0; i<NumElements;i++)
{
if (document.LANSA.elements[i].name==Field)
{
document.LANSA.elements[i].value=RDate;
break;
}
}
}
function HandleEvent(Proc,Func)
{
<RDML ONCONDITION="&DEBUG">
document.LANSA.action+="+BDEBUG+<RDML MERGE="&DEVICE">+<RDML MERGE="&MSGQ">";
</RDML>
document.LANSA._PROCESS.value=Proc;
document.LANSA._FUNCTION.value=Func;
document.LANSA.submit();
}
function isValidNumeric(theObj, integers,decimals,decimalPoint)
{
var FieldValue = theObj.value;
var returnString = "";
var befdecCount = 0;
var PastDec = false;
var aftdecCount = 0;
for (var i = 0; i < FieldValue.length; i++)
{
if (isDigit(FieldValue.charAt(i)))
{
if (PastDec)
{
aftdecCount++
if (aftdecCount <= decimals)
returnString += FieldValue.charAt(i)
}
else
{
befdecCount++
if (befdecCount <= integers)
returnString += FieldValue.charAt(i)
}
}
else
{
if (FieldValue.charAt(i) == decimalPoint)
PastDec = true
returnString += FieldValue.charAt(i);
}
}
if ((befdecCount > integers) || (aftdecCount > decimals))
{
alert("Allowable digits before decimal point = " + integers +
"\nAllowable digits after decimal point = " + decimals +
"\nData will be truncated accordingly.")
theObj.value = returnString
return false
}
return true
}
function isDigit(theDigit)
{
digitArray = new Array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9')
for (var j = 0; j < digitArray.length; j++)
if (theDigit == digitArray[j])
return true
return false
}
function isValidDBCS(theObj,KeybdShift,EBCDICLength)
{
var FieldValue = theObj.value;
var returnString = "";
var totalDBCS = 0;
var totalSBCS = 0;
var totalLength = 0;
var inDBCS = false;
for (var i = 0; i < FieldValue.length; i++)
{
if (isDBCSChar(FieldValue.charAt(i)))
{
if (!inDBCS)
{
inDBCS = true
totalLength+=2
}
totalLength += 2;
if ((totalLength <= EBCDICLength) && (KeybdShift != 'A'))
{
returnString += FieldValue.charAt(i)
returnString += FieldValue.charAt(i+1)
}
totalDBCS++
i++
}
else
{
totalLength += 1;
if ((totalLength <= EBCDICLength) && (KeybdShift != 'J'))
returnString += FieldValue.charAt(i)
if (inDBCS) inDBCS = false
totalSBCS++
}
}
if (totalLength > EBCDICLength)
{
alert("Converted length of characters entered is " + totalLength +
"\nwhich exceeds the maximum allowable length of " + EBCDICLength +
"\nData will be truncated accordingly.")
theObj.value = returnString
return false
}
if ((KeybdShift == 'J') && (totalSBCS > 0))
{
alert("Only DBCS characters are allowed in this field.\n" +
totalSBCS + " SBCS characters have been entered.\n" +
"SBCS characters will be removed.")
theObj.value = returnString
return false
}
if ((KeybdShift == 'E') && (totalSBCS > 0) && (totalDBCS > 0))
{
alert("Either all DBCS characters or all SBCS characters " +
"are allowed in this field.\n" +
totalSBCS + " SBCS characters have been entered.\n" +
totalDBCS + " DBCS characters have been entered.\n" +
"Please modify field data accordingly.")
return false
}
if ((KeybdShift == 'A') && (totalDBCS > 0))
{
alert("Only SBCS characters are allowed in this field.\n" +
totalDBCS + " DBCS characters have been entered.\n" +
"DBCS characters will be removed.")
theObj.value = returnString
return false
}
return true
}
function isDBCSChar(theChar)
{
if (((theChar >= '\x81') && (theChar <= '\x9F')) ||
((theChar >= '\xE0') && (theChar <= '\xFC')))
return true
return false
}
function SetCBState(obj, RFld, chkvalue, unchkvalue)
{
var NumElements=document.LANSA.elements.length;
for (i=0; i<NumElements;i++)
{
if (document.LANSA.elements[i].name==RFld)
{
if (obj.checked) document.LANSA.elements[i].value=chkvalue
else document.LANSA.elements[i].value=unchkvalue;
break;
}
}
}
function SetState(obj, RFld, chkValue, unchkValue)
{
if (obj.checked)
RFld.value=chkValue
else
RFld.value=unchkValue
}
function NextButton(Button)
{
document.LANSA.AS_ACTIONX.value=Button;
HandleEvent('<RDML MERGE="*PROCESS">', '<RDML MERGE="*FUNCTION">');
}
<RDML MERGE="&DEBUG">
// --> </SCRIPT>
<SCRIPT LANGUAGE="JavaScript"> <!--
function SetButton(btnvalue)
{
document.LANSA._BUTTON.value = btnvalue;
}
function HandleSubmit()
{
document.LANSA.submit();
}
function pathOnly(InString)
{
LastSlash=InString.lastIndexOf('/',InString.length-1);
OutString=InString.substring(0,LastSlash+1);
return(OutString);
}
function GetHelp()
{
if (document.LANSA._NAME.value != "&NULL")
{
var ref = pathOnly(location.href);
var lweb = "LANSAWEB?FUNCHELP+<RDML MERGE="&SESSION">+";
var opt = "width=350,height=425,directories=no,toolbar=no,";
var win;
opt += "menubar=no,scrollbars=yes,resizable=yes";
ref += lweb;
ref += document.LANSA._NAME.value;
win = window.open(ref,"lansahelp", opt);
}
}
function GetExtraInfo(ListName, EntryNum, Field1, Field2, Field3, Field4, Field5)
{
var ref = pathOnly(location.href);
var lweb = "LANSAWEB?FLDCONT+<RDML MERGE="&SESSION">+";
var opt = "width=350,height=425,directories=no,toolbar=no,";
var win;
opt += "menubar=no,scrollbars=yes,resizable=yes";
ref += lweb+EntryNum + "+" + ListName;
if (Field1 != '&NULL')
{
ref += "+" + Field1;
if (Field2 != '&NULL')
{
ref += "+" + Field2;
if (Field3 != '&NULL')
{
ref += "+" + Field3;
if (Field4 != '&NULL')
{ |
if (Field5 != '&NULL')
{
ref += "+" + Field5;
}
}
}
}
}
win = window.open(ref,"lansahelp", opt);
}
function SetSelect(HTMLName, Name,Row,Column,Select)
{
document.LANSA._SELECT.value=Select;
SetNameLocation(Name,Row,Column);
document.LANSA._CALFLD.value=HTMLName;
return;
}
function SetNameLocation(Name,Row,Column)
{
document.LANSA._NAME.value=Name;
document.LANSA._ROW.value=Row;
document.LANSA._COLUMN.value=Column;
document.LANSA._CALFLD.value=Name;
return;
}
function CallCalendar()
{
if (document.LANSA._CALFLD.value != "&NULL")
{
var opt = "width=340,height=385,directories=no,toolbar=no,";
opt += "menubar=no,scrollbars=no,resizable=yes";
win = window.open("/images/lcalen.htm", "calendar", opt);
win.opener=window;
}
}
function SetDate(day, month, year)
{
var Field=document.LANSA._CALFLD.value;
if (year < 2000)
{
YearRet=year-1900;
}
else
{
YearRet=year-2000;
}
var RDate=day+"/"+month+"/";
if (YearRet<10)
RDate+="0"+YearRet;
else
RDate+=YearRet;
var NumElements=document.LANSA.elements.length;
for (i=0; i<NumElements;i++)
{
if (document.LANSA.elements[i].name==Field)
{
document.LANSA.elements[i].value=RDate;
break;
}
}
}
function HandleEvent(Proc,Func)
{
<RDML ONCONDITION="&DEBUG">
document.LANSA.action+="+BDEBUG+<RDML MERGE="&DEVICE">+<RDML MERGE="&MSGQ">";
</RDML>
document.LANSA._PROCESS.value=Proc;
document.LANSA._FUNCTION.value=Func;
document.LANSA.submit();
}
function isValidNumeric(theObj, integers,decimals,decimalPoint)
{
var FieldValue = theObj.value;
var returnString = "";
var befdecCount = 0;
var PastDec = false;
var aftdecCount = 0;
for (var i = 0; i < FieldValue.length; i++)
{
if (isDigit(FieldValue.charAt(i)))
{
if (PastDec)
{
aftdecCount++
if (aftdecCount <= decimals)
returnString += FieldValue.charAt(i)
}
else
{
befdecCount++
if (befdecCount <= integers)
returnString += FieldValue.charAt(i)
}
}
else
{
if (FieldValue.charAt(i) == decimalPoint)
PastDec = true
returnString += FieldValue.charAt(i);
}
}
if ((befdecCount > integers) || (aftdecCount > decimals))
{
alert("Allowable digits before decimal point = " + integers +
"\nAllowable digits after decimal point = " + decimals +
"\nData will be truncated accordingly.")
theObj.value = returnString
return false
}
return true
}
function isDigit(theDigit)
{
digitArray = new Array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9')
for (var j = 0; j < digitArray.length; j++)
if (theDigit == digitArray[j])
return true
return false
}
function isValidDBCS(theObj,KeybdShift,EBCDICLength)
{
var FieldValue = theObj.value;
var returnString = "";
var totalDBCS = 0;
var totalSBCS = 0;
var totalLength = 0;
var inDBCS = false;
for (var i = 0; i < FieldValue.length; i++)
{
if (isDBCSChar(FieldValue.charAt(i)))
{
if (!inDBCS)
{
inDBCS = true
totalLength+=2
}
totalLength += 2;
if ((totalLength <= EBCDICLength) && (KeybdShift != 'A'))
{
returnString += FieldValue.charAt(i)
returnString += FieldValue.charAt(i+1)
}
totalDBCS++
i++
}
else
{
totalLength += 1;
if ((totalLength <= EBCDICLength) && (KeybdShift != 'J'))
returnString += FieldValue.charAt(i)
if (inDBCS) inDBCS = false
totalSBCS++
}
}
if (totalLength > EBCDICLength)
{
alert("Converted length of characters entered is " + totalLength +
"\nwhich exceeds the maximum allowable length of " + EBCDICLength +
"\nData will be truncated accordingly.")
theObj.value = returnString
return false
}
if ((KeybdShift == 'J') && (totalSBCS > 0))
{
alert("Only DBCS characters are allowed in this field.\n" +
totalSBCS + " SBCS characters have been entered.\n" +
"SBCS characters will be removed.")
theObj.value = returnString
return false
}
if ((KeybdShift == 'E') && (totalSBCS > 0) && (totalDBCS > 0))
{
alert("Either all DBCS characters or all SBCS characters " +
"are allowed in this field.\n" +
totalSBCS + " SBCS characters have been entered.\n" +
totalDBCS + " DBCS characters have been entered.\n" +
"Please modify field data accordingly.")
return false
}
if ((KeybdShift == 'A') && (totalDBCS > 0))
{
alert("Only SBCS characters are allowed in this field.\n" +
totalDBCS + " DBCS characters have been entered.\n" +
"DBCS characters will be removed.")
theObj.value = returnString
return false
}
return true
}
function isDBCSChar(theChar)
{
if (((theChar >= '\x81') && (theChar <= '\x9F')) ||
((theChar >= '\xE0') && (theChar <= '\xFC')))
return true
return false
}
function SetCBState(obj, RFld, chkvalue, unchkvalue)
{
var NumElements=document.LANSA.elements.length;
for (i=0; i<NumElements;i++)
{
if (document.LANSA.elements[i].name==RFld)
{
if (obj.checked) document.LANSA.elements[i].value=chkvalue
else document.LANSA.elements[i].value=unchkvalue;
break;
}
}
}
function SetState(obj, RFld, chkValue, unchkValue)
{
if (obj.checked)
RFld.value=chkValue
else
RFld.value=unchkValue
}
function NextButton(Button)
{
document.LANSA.AS_ACTIONX.value=Button;
HandleEvent('<RDML MERGE="*PROCESS">', '<RDML MERGE="*FUNCTION">');
}
<RDML MERGE="&DEBUG">
// --> </SCRIPT>