...

View Full Version : Newbie struggling with forms



fatmess
05-23-2009, 02:26 AM
Hi,
could some kind expert point me in the right direction with this beginner question.

At this stage I simply want to click to select a checkbox and then click a button that will open a MsgBox and announce which checkbox I clicked.

Depending on which checkbox I clicked I get the error;




Line: 55
Char: 1
Error: Type mismatch: 'RunScript'
Code:0
URL: http://bla bla bla

Here is my code;


<html>
<head>
<title>My Page</title>
<script type="text/VBScript" language="VBScript">
Sub RunScript()
If b80.checked Then
Runb80()
End If
If b8vpn checked Then
Runb8vpn()
End If
If bdevo checked Then
Runbdevo()
End If
If bdevvpn checked Then
Runbdevvpn()
End If
If b70 checked Then
Runb70()
End If
If b7vpn checked Then
Runb7vpn()
End If
End Sub
Sub Runb80()
MsgBox("you called Runb80")
End Sub
Sub Runb8vpn()
MsgBox("you called Runb8vpn")
End Sub
Sub Rundevo()
MsgBox("you called Rundevo")
End Sub
Sub Runbdevvpn()
MsgBox("you called Runbdevvpn")
End Sub
Sub Runb70()
MsgBox("you called Runb70")
End Sub
Sub Runb7vpn()
MsgBox("you called Runb7vpn")
End Sub
</Script>
</head>
<body>
<form name="myform" action="">
<div><br>
<input type="checkbox" name="b80" value="b80"> b80<br>
<input type="checkbox" name="b8vpn" value="b8vpn"> b8vpn<br>
<input type="checkbox" name="bdevo" value="bdevo"> bdevo
<input type="checkbox" name="bdevvpn" value="bdevvpn"> bdevvpn<br>
<input type="checkbox" name="b70" value="b70"> b70<br>
<input type="checkbox" name="b7vpn" value="b7vpn"> b7vpn<br>
<input type="button" value="Run" name="run_button" onClick="RunScript()">
</div>
</form>
</div>
</form>
</body>
</html>

Thank you to any kind expert that can spot the flaw for me.

fatmess
05-23-2009, 03:07 AM
Hi,
I have spotted a flaw and resolved it but it has brought about another error;

The code now looks like this.




<html>
<head>
<title>My Page</title>
<script type="text/VBScript" language="VBScript">
Sub RunScript()
If b80.checked Then
Runb80()
End If
If b8vpn.checked Then
Runb8vpn()
End If
If bdevo.checked Then
Runbdevo()
End If
If bdevvpn.checked Then
Runbdevvpn()
End If
If b70.checked Then
Runb70()
End If
If b7vpn.checked Then
Runb7vpn()
End If
End Sub
Sub Runb80()
MsgBox("you called Runb80")
End Sub
Sub Runb8vpn()
MsgBox("you called Runb8vpn")
End Sub
Sub Rundevo()
MsgBox("you called Rundevo")
End Sub
Sub Runbdevvpn()
MsgBox("you called Runbdevvpn")
End Sub
Sub Runb70()
MsgBox("you called Runb70")
End Sub
Sub Runb7vpn()
MsgBox("you called Runb7vpn")
End Sub
</Script>
</head>
<body>
<form name="myform" action="">
<div><br>
<input type="checkbox" name="b80" value="b80"> b80<br>
<input type="checkbox" name="b8vpn" value="b8vpn"> b8vpn<br>
<input type="checkbox" name="bdevo" value="bdevo"> bdevo
<input type="checkbox" name="bdevvpn" value="bdevvpn"> bdevvpn<br>
<input type="checkbox" name="b70" value="b70"> b70<br>
<input type="checkbox" name="b7vpn" value="b7vpn"> b7vpn<br>
<input type="button" value="Run" name="run_button" onClick="RunScript()">
</div>
</form>
</div>
</form>
</body>
</html>

and the error now looks like this;




Line: 6
Char: 1
Error: Object required:'b80'
Code:0
URL:http://bla bla bla

Thank you again for your help



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum