kateyez44
11-25-2002, 10:21 AM
Hi. I was wondering how I could call a VBScript function from within a JavaScript function. When my form is submitted, a JavaScript function to validate the form is called. The Validate function calls another JavaScript function that returns true or false. I would like to conditionally call a VBScript function from the JavaScript function depending on whether true or false is returned. The VBScript function calls a COM object to save changes to the form. Here is what I have tried:
<SCRIPT TYPE="text/vbscript" LANGUAGE="VBScript">
<!--
Function SaveChanges()
Dim tmpMonth, tmpDay, tmpYear, tmpDate
intFrmID = 1
Set oDBCnObj = Server.CreateObject("AASForm525D3DB.DBConnect")
oDBCnObj.ConnectToDB
Set oDBFunctions = Server.CreateObject("AASForm525D3DB.Form525D3DB")
oDBFunctions.SetActiveConnection oDBCnObj.GetCurrentConnection
Set rsClaimant = oDBFunctions.LoadClaimantForm(CInt(intFrmID))
End Function
-->
</SCRIPT>
</SCRIPT>
<SCRIPT TYPE="text/javascript" LANGUAGE="JavaScript">
<!--
function ValidateClaimantDrugForm()
{var objForm = document.frmClaimantDrug;
var blSaved;
with (objForm) {
var strEmpBegin = lstEmpBeginM.value + "/" + txtEmpBeginD.value + "/" + txtEmpBeginY.value;
.
.
.
.
if (doValidation())
{
blSaved = Function('return SaveChanges()');
if(blSaved == true)
{
return false;
}
else if(blSaved == false)
{
return true;
}
}
else
{
return false;
}
}//with
} //validateClaimantDrugForm
This is not working at all. How in the world do I go about doing this? I appreciate any help or advice.
<SCRIPT TYPE="text/vbscript" LANGUAGE="VBScript">
<!--
Function SaveChanges()
Dim tmpMonth, tmpDay, tmpYear, tmpDate
intFrmID = 1
Set oDBCnObj = Server.CreateObject("AASForm525D3DB.DBConnect")
oDBCnObj.ConnectToDB
Set oDBFunctions = Server.CreateObject("AASForm525D3DB.Form525D3DB")
oDBFunctions.SetActiveConnection oDBCnObj.GetCurrentConnection
Set rsClaimant = oDBFunctions.LoadClaimantForm(CInt(intFrmID))
End Function
-->
</SCRIPT>
</SCRIPT>
<SCRIPT TYPE="text/javascript" LANGUAGE="JavaScript">
<!--
function ValidateClaimantDrugForm()
{var objForm = document.frmClaimantDrug;
var blSaved;
with (objForm) {
var strEmpBegin = lstEmpBeginM.value + "/" + txtEmpBeginD.value + "/" + txtEmpBeginY.value;
.
.
.
.
if (doValidation())
{
blSaved = Function('return SaveChanges()');
if(blSaved == true)
{
return false;
}
else if(blSaved == false)
{
return true;
}
}
else
{
return false;
}
}//with
} //validateClaimantDrugForm
This is not working at all. How in the world do I go about doing this? I appreciate any help or advice.