www.webdeveloper.com
Results 1 to 2 of 2

Thread: Can I call a VBScript Function from a JavaScript function?

  1. #1
    Join Date
    Nov 2002
    Location
    Columbia, MD
    Posts
    14

    Unhappy Can I call a VBScript Function from a JavaScript function?

    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:

    Code:
    <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.

  2. #2
    Join Date
    Dec 2002
    Location
    Little Rock, AR
    Posts
    3

    Thumbs up

    Yes. The way I have done this is to use a form with hidden fields and programmatically click the submit button to an ASP page. If you have any variables you are wanting to save/store in a db or file, you must load that information into hidden fields (that is what I have done).

    Let me know if you need further clarification.

    >DREW<

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles