'**-- display errors at top of the page
'**-- with links to focus error Input
function DisplayError(strErrXml,strErrMsg,strErrDivId,lngErrDivHSpacePixels)
dim objDiv
dim strHtml
dim strErrName
dim arrErrMsg
dim strXMLErrMsg
dim objXmlRs
dim i
dim j
dim strFullHtml
set objXmlRs = new XMLRecordset
objXmlRs.XML = strErrXml
arrErrMsg = Split(strErrMsg,vbCrLf)
for i = 0 to UBound(arrErrMsg)
strErrName = arrErrMsg(i)
if strErrName <> "" then
strHtml = strHtml & "" & objXmlRs.Fields(strErrName).Value & "
"
'**-- if this error about user_name exist then show others
if strErrName = "txtUserName_3" then
for j=0 to UBound(arrOtherUserNames)
if arrOtherUserNames(j) <> "" then
strHtml = strHtml & " " & arrOtherUserNames(j) & "
"
end if
next
end if
end if
next
'**-- collect full html
strFullHtml = strFullHtml & "
"
if lngErrDivHSpacePixels > 0 then
strFullHtml = strFullHtml & " |
"
end if
strFullHtml = strFullHtml & "| " & strHtml & " |
"
if lngErrDivHSpacePixels > 0 then
strFullHtml = strFullHtml & " |
"
end if
strFullHtml = strFullHtml & "
"
set objDiv = document.getElementById(strErrDivId)
objDiv.innerHTML = strFullHtml
set objDiv = nothing
end function
'**-- get error input name -
'**-- remove _2,_3,... from error name to get real Input name
'**-- focus on this input
function FocusErrorInput(strErrName)
dim strInput
dim arrTmp
dim objInput
if InStr(1,strErrName,"_") > 0 then
arrTmp = Split(strErrName,"_")
strInput = arrTmp(0)
else
strInput = strErrName
end if
set objInput = document.getElementsByName(strInput).item
if not objInput is nothing then
objInput.focus()
end if
set objInput = nothing
end function
'**-- write selected user name into text box
function SelectOtherUserName(strOtherUserName)
dim objInput
set objInput = document.getElementsByName("txtUserName").item
if not objInput is nothing then
objInput.value = strOtherUserName
objInput.focus()
end if
set objInput = nothing
end function