vbscript and javascript together
I am validating form using both vbscript and javascript. I am getting the dynamic input data from web page using vbscript and validating the field with javascript. I am having hard time in the bold area, Javascript doesn't recognize it since I get the input with vbscript. Is there any way that Jscript and vbscript can communicate each other or any help. Here is the my code...
<script type="text/javascript">
<!--
function hasSelection(Setup,strFieldName,strMsg) {
var objFormField = Setup.elements[strFieldName];
if(objFormField.selectedIndex ==0) {
strAlertMsg += "- "+ strMsg +" is Required.\n";
if(!focusField) focusField=""+ strFieldName +"";
return false;
}
return true;
}
function validateForm(Setup){
alert(<%=nID%>_RootCaused)
strAlertMsg = ""
focusField = ""
hasSelection(Setup,'<%=nID%>_RootCaused','RootCaused')
if(strAlertMsg !=""){
alert("Please correct the following errors:\n__\n\n"+ strAlertMsg);
eval("Setup." + focusField + ".focus()");
return false;
}
return true;
}
//-->
</script>
//There is a database connection...
nID = rsListCounts("nID")
<form name="Setup" method="post" action="CycleProcess1.asp?Type=MLS" onsubmit="return validateForm(this);">
<select NAME="<%=nID%>_RootCaused" size="1">
<option value="Empty">Please Select Root Cause</option>
<%rsListRootCauses.MoveFirst()%>
<%While NOT rsListRootCauses.EOF%>
<%
sVal = rsListRootCauses("strRootCause")
sValue = rsListRootCauses("strRootCauseDesc")
%>
<option value="<%=sVal%>"><%=sValue%></option>
<%rsListRootCauses.MoveNext() : Wend%>
</select>
<INPUT TYPE="SUBMIT" NAME="Setup" VALUE="Save Root Cause" >
<INPUT TYPE="SUBMIT" NAME="Setup" VALUE="Quit"></TD>
</form>
thanks....
|