• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 374
  • Last Modified:

runtime error while calling a subroutine

HAving a runtime error while calling a subroutine().

thanks:

<%@ Language=VBScript %>
<HTML>
<HEAD>
</HEAD>
<BODY>

<P><STRONG>Name </STRONG>  <INPUT id=text1 name=text1></P>
<P><STRONG>Email&nbsp; </STRONG><INPUT id=text2 name=text2></P>
<P>&nbsp;</P>
<P><INPUT LANGUAGE = "VBSCRIPT" type=button
      value=Button ONCLICK="call Validation()"  
      NAME="btn1" ></P>
<P>&nbsp;</P>

<%
Sub Validation()
      Select Case True
            Case text1.value = ""
                  msgbox "Please Enter Text"
                  ret = false
                  call text1.focus()
            Case text2.value = ""
                  msgbox "Please Enter Text"
                  ret = false
                  call text2.focus()
            case else
                  ret=true
            
      End Select
      
End Sub


%>


</BODY>
</HTML>
0
tparvaiz
Asked:
tparvaiz
1 Solution
 
PBallCommented:
Confusion.

Client Side Script trying to call Server Side Script.  A no no.

Anything ASP (<% ... %>) will be executed before the page is sent to the client browser.

Your event handler cannot find any client side function called Validation.

<HTML>
<HEAD>

<SCRIPT LANGUAGE="VBScript">

Sub Validation()
  Select Case True
  Case text1.value = "" 
    msgbox "Please Enter Text"
    ret = false
    call text1.focus()
  Case text2.value = "" 
    msgbox "Please Enter Text"
    ret = false
    call text2.focus()
  case else
    ret=true
  End Select
End Sub

</SCRIPT>

</HEAD>
<BODY>

<P><STRONG>Name </STRONG>  <INPUT id=text1 name=text1></P>
<P><STRONG>Email&nbsp; </STRONG><INPUT id=text2 name=text2></P>
<P>&nbsp;</P>
<P><INPUT LANGUAGE = "VBSCRIPT" type=button
value=Button ONCLICK="Validation()"  
NAME="btn1" ></P>
<P>&nbsp;</P>

</BODY>
</HTML>
0
 
tparvaizAuthor Commented:
Thanks PBall
I am increasing points because I have another question.
On correct/valid inputs, I want to send text data to another .asp file and would  like to read data there
thanks
0

Featured Post

[Webinar] Kill tickets & tabs using PowerShell

Are you tired of cycling through the same browser tabs everyday to close the same repetitive tickets? In this webinar JumpCloud will show how you can leverage RESTful APIs to build your own PowerShell modules to kill tickets & tabs using the PowerShell command Invoke-RestMethod.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now