Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Other Programming > VBScript
VBScript For questions and discussions related to VBScript.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VBScript section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old October 14th, 2003, 09:27 AM
Authorized User
Join Date: Oct 2003
Posts: 29
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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){
strAlertMsg = ""
focusField = ""


    if(strAlertMsg !=""){
     alert("Please correct the following errors:\n__\n\n"+ strAlertMsg);
     eval("Setup." + focusField + ".focus()");
     return false;
    return true;
//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>
<%While NOT rsListRootCauses.EOF%>
sVal = rsListRootCauses("strRootCause")
sValue = rsListRootCauses("strRootCauseDesc")
<option value="<%=sVal%>"><%=sValue%></option>
<%rsListRootCauses.MoveNext() : Wend%>

<INPUT TYPE="SUBMIT" NAME="Setup" VALUE="Save Root Cause" >

Reply With Quote
  #2 (permalink)  
Old October 21st, 2003, 02:48 PM
Friend of Wrox
Join Date: Jun 2003
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts

The only way I know how to pass in a parameter like that (not dynamically) is using ASP, you can reference an ASP variable using <%=nID%> in that manner in javascript code. Of course, in ASP the value cannot be dynamically changed, not without refreshing the page.
Reply With Quote

Similar Threads
Thread Thread Starter Forum Replies Last Post
Convert JavaScript OK/CANCEL to VBScript timmerdfw VBScript 0 January 4th, 2007 03:42 PM
JavaScript to VBScript Thomas82 Classic ASP Basics 1 July 29th, 2006 07:03 PM
Javascript and VBScript woes 1up Javascript How-To 18 November 7th, 2005 03:18 PM
Using VBScript variables in Javascript PL Classic ASP Basics 4 July 29th, 2004 03:05 PM
Using VBScript and JavaScript together jwalborn Classic ASP Professional 2 October 13th, 2003 10:06 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.