I got following error
Error Type:
Microsoft VBScript runtime (0x800A000D)
Type mismatch: 'htmlEncode'
/etravel1.0/ERParameters.asp, line 162
Browser Type:
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; .NET CLR 1.1.4322)
i have given code below.
can someone help me resolving this issue URGENTLY.
<%@ Language=VBScript %>
<%option explicit
Response.Expires=0
Response.Buffer =true
Response.Clear()
Const AccountNo_Width = 15%>
<%
'-----------------------------------------------------------------------------------------------------------------------
function GetValue_Sys(aKey,aVar)
if instr("DESC1,DESC2",aVar)>0 then GetValue_Sys=""
For iCounter = 1 to uBound(arrParameters)
if arrParameters(iCounter,1)=aKey then
select case aVar
case "DESC1" : GetValue_Sys=arrParameters(iCounter,2)
case "DESC2" : GetValue_Sys=arrParameters(iCounter,3)
case "DESC3" : GetValue_Sys=arrParameters(iCounter,4)
case "VALUE1" : GetValue_Sys=arrParameters(iCounter,5)
case "VALUE2" : GetValue_Sys=arrParameters(iCounter,6)
case "VALUE3" : GetValue_Sys=arrParameters(iCounter,7)
end select
exit for
end if
Next
end function
'-----------------------------------------------------------------------------------------------------------------------
Sub Save_SystemParameters()
Dim ConnObj, iPos
Set ConnObj = Server.CreateObject("ADODB.Connection")
ConnObj.Open Session("ConnString")
ConnObj.begintrans
iPos = 0
for i=1 to 50
iPos=i : if len(iPos)=1 then iPos = "0" & iPos
if trim(Request.Form("ExpAccountNo"&i)) <> "" and trim(Request.Form("ExpAccountHead"&i)) <> "" then
Call UpdateSetup(ConnObj,"ERSEC_"&iPos, Request.Form("ExpAccountHead"&i), Request.Form("ExpAccountNo"&i),"",BookBy(Request.F orm("ExpBookByEmployee"&i)),BookBy(Request.Form("E xpCostcentre"&i)),0)
end if
next
ConnObj.CommitTrans
ConnObj.Close
Set ConnObj = Nothing
session("mMsg")="System Parameters are updated successfully"
Response.Redirect "screen.asp"
End Sub
'-----------------------------------------------------------------------------------------------------------------------
function BookBy(mCheckbox)
if mCheckbox <> "" then
BookBy=1
else
BookBy=0
end if
end function
'-----------------------------------------------------------------------------------------------------------------------
function UpdateSetup(ConnObj,aKey,aDesc1,aDesc2,aDesc3,aVal ue1,aValue2,aValue3)
dim sqlstr, rstSetup
set rstSetup=server.CreateObject("ADODB.Recordset")
sqlstr="select * from setup where KEY= '" & aKey & "'"
rstSetup.Open SqlStr,ConnObj, adOpenDynamic,adLockOptimistic, adcmdtext
if rstSetup.eof then
rstSetup.AddNew
rstSetup.Fields("Key")=aKey
end if
rstSetup.Fields("Desc1")=aDesc1
rstSetup.Fields("Desc2")=aDesc2
rstSetup.Fields("Desc3")=aDesc3
if Trim(aValue1)<> "" then
rstSetup.Fields("Value1")=ccur(aValue1)
end if
if Trim(aValue2)<> "" then
rstSetup.Fields("Value2")=ccur(aValue2)
end if
if Trim(aValue3)<> "" then
rstSetup.Fields("Value3")=ccur(aValue3)
end if
rstSetup.Update
rstSetup.close
set rstSetup = nothing
end function
'-----------------------------------------------------------------------------------------------------------------------
'-----------------------------------------------------------------------------------------------------------------------
Dim arrParameters(),SqlStr,iCounter,rstSetup
Dim i,j,RPTCurr1,SubmitFlag,VoucherRemarks1_TR,Voucher Remarks2_TR,VoucherRemarks3_TR,VoucherRemarks1_ER, VoucherRemarks2_ER,VoucherRemarks3_ER
Dim KeyPressCode
Dim ConnObj,OtherDetail_Desc
if session("LoggedOut") then Response.Redirect "message.asp"
SubmitFlag = Request.Form("txtSubmitFlag")
Set ConnObj = Server.CreateObject("ADODB.Connection")
ConnObj.Open Session("connString")
If SubmitFlag="True" then
Save_SystemParameters()
End If
Set rstSetup=server.CreateObject("ADODB.Recordset")
Sqlstr="Select * from setup"
rstSetup.CursorLocation = aduseclient
rstSetup.Open SqlStr,ConnObj,adOpenDynamic,adLockOptimistic
if rstSetup.RecordCount > 0 then
redim arrParameters(rstSetup.RecordCount,7)
else
redim arrParameters(1,7)
end if
iCounter=0
Do while not rstSetup.eof
iCounter = iCounter + 1
arrParameters(iCounter,1)=rstSetup("Key")
arrParameters(iCounter,2)=rstSetup("Desc1")
arrParameters(iCounter,3)=rstSetup("Desc2")
arrParameters(iCounter,4)=rstSetup("Desc3")
arrParameters(iCounter,5)=rstSetup("Value1")
arrParameters(iCounter,6)=rstSetup("Value2")
arrParameters(iCounter,7)=rstSetup("Value3")
rstSetup.MoveNext
Loop
rstSetup.Close
set rstSetup = Nothing
KeyPressCode = "LANGUAGE='javascript' onfocus='select()' onKeyPress='keyhandler()'"
%>
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
<link href="Eilisys.css" rel="STYLESHEET" type="text/css">
<link href="Menu/coolmenu.css" rel="STYLESHEET" type="text/css">
<script type="text/javascript" src="Menu/coolmenupro.
js"></script>
</HEAD>
<BODY>
<FORM Name="thisForm" Id="thisForm" Method="Post" action="ERParameters.asp" >
<table BORDER="0" CELLSPACING="0" CELLPADDING="0" rightmargin="0" CLASS="full">
<tr><td colspan="2" valign="middle" height="5px"></td></tr>
<tr height="30px">
<td valign="top" align="center" width="98%">
<table BORDER="0" CELLSPACING="0" CELLPADDING="0" width="100%">
<tr>
<td width="85%" class="SelectedMenu"> <img src="images/ImgMenu/inbox.gif" border="0"> Expense Report Parameters</td>
<td width="15%"><a href="screen.asp"><img src="Images/reset.gif" border="0" Style="Cursor:Hand"></a>Exit</td>
</tr>
<tr><td colspan="2"><BR></td></tr>
</TABLE>
</td>
</tr>
<tr>
<td align="center">
<table border=0 width=65% class="stdTableBorder" cellspacing=0 cellpadding=1 valign=top align=center>
<TR bgcolor="#6186B3" height="22px">
<TD nowrap width="30%" class="InnerHeader">Account Head</TD>
<TD nowrap width="20%" class="InnerHeader">Account No</TD>
<TD nowrap width="25%" class="InnerHeader">Book by Employee</TD>
<TD nowrap width="25%" class="InnerHeader">Book by Cost Centre<Input type="HIDDEN" Name="txtSubmitFlag" Id="txtSubmitFlag" Value="">
</TD>
</TR>
<%for i=1 to 50
j = right("0" & i,2) %>
<TR>
<TD nowrap><INPUT type="text" class="inputalignleft" id="ExpAccountHead<%=i%>" name="ExpAccountHead<%=i%>" size=30 maxlength=20 value="<%=Server.htmlEncode(GetValue_Sys("ERSEC_"& J,"DESC1"))%>" <%=KeyPressCode%>></TD>
<TD nowrap><INPUT type="text" class="inputalignleft" id="ExpAccountNo<%=i%>" name="ExpAccountNo<%=i%>" size=10 maxlength=10 value="<%=GetValue_Sys("ERSEC_"&J,"DESC2") %>" <%=KeyPressCode%>></TD>
<TD nowrap align=center>
<INPUT type="checkbox" id="ExpBookByEmployee<%=i%>" name="ExpBookByEmployee<%=i%>" <%=KeyPressCode%> <%if 1 = GetValue_Sys("ERSEC_"&J,"VALUE1") then Response.Write "Checked"%> ></TD>
<TD nowrap align=center><INPUT type="checkbox" id="ExpCostcentre<%=i%>" name="ExpCostcentre<%=i%>" <%=KeyPressCode%> <%if 1= GetValue_Sys("ERSEC_"&J,"VALUE2") then Response.Write "Checked"%> ></TD>
</TR>
<%next%>
</TABLE>
</td>
</tr>
<tr>
<td align="center">
<TABLE BORDER=0 CELLSPACING=1 CELLPADDING=1 >
<TR>
<TD align=center>
<input type="Button" name="BtnSubmit" Id="BtnSubmit" Class="stdButton" Title="Click To Update System Parameters" value="Save Parameters" onClick="BtnSubmit_Onclick();">
</TD>
</TR>
</TABLE>
</td>
</tr>
</table>
</FORM>
<%
ConnObj.Close
Set ConnObj = Nothing
%>
</BODY>
</HTML>
<script language="javascript">
function BtnSubmit_Onclick()
{
document.thisForm.txtSubmitFlag.value = "True"
document.thisForm.submit()
}
function ProcessKeyDown()
{
if (window.event.keycode = 13)
{
window.event.keycode = 9;
}
}
// if (document.layers) document.captureEvents(Event.KEYPRESS); // needed if you wish to cancel the key
document.onkeydown = keyhandler;
// document.myForm.myField.onkeypress = keyhandler;
function keyhandler(e)
{
var key;
var keychar;
var reg;
if (window.event)
{
if (window.event.keyCode == 13)
{
// for IE, e.keyCode or window.event.keyCode can be used
window.event.keyCode=9;
key = window.event.keyCode;
}
}
else if(e.which == 13)
{
// netscape
e.which=9;
alert(e.which);
}
else {
// no event, so pass through
return true;
}
alert(
keychar = String.fromCharCode(key);
reg = /\d/;
alert(!reg.test(keychar));
return !reg.test(keychar);
}
</script>
neel