Scripting within a Form, where to put it?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I created page which has scritping in it. I.e. if you check one of the
checkboxes, it automatically checks a couple of other boxes and launches
other sub's, etc...

Ex:

Sub LireEcrire1_onclick
LireEcrire2.checked = FALSE
LireEcrire3.checked = FALSE
LireEcrire4.value = 0
validation()
ptvecu() End Sub

This used to work perfectly, but I want to convert my simple web page into a
form and be able to use "Form Properties" functionality

I managed to copy paste my page contents into a new form, but no matter
where I paste my </SCRIPT> code, it gives me errors like "Expected end of
statement"

I tried putting the scripting at the beginning, at the end or oustide of the
form section with no success.

<form ...
</form>

Is scripting compatible with forms?

Thanks
 
Scripting should normally be placed in the head section of the web page and enclosed in <script> tags.

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>New Page 1</title>
<script type="text/vbscript" language="vbscript" >
Sub LireEcrire1_onclick
LireEcrire2.checked = FALSE
LireEcrire3.checked = FALSE
LireEcrire4.value = 0
validation()
ptvecu()
End Sub
</script>
</head>

<body>

</body>
</html>
 
I tried the suggestion and put the Script in the head of my document.
Unfortunately it had no effect. It would seem that is not the cause of my
problems.

I beleive the problem must lie in a particular syntax or variable
declaration that I must add so that my VBScripts can run in cunjunction with
Forms. My page works fine when no <form method="POST"
action="--WEBBOT-SELF--">...</form> syntax is entered.

If Form syntax is present, I get "Object required" errors. If I enter
simple scripts like "MyNumber = 3" then I get no errors, but if my script
includes references to Form Objects like "CheckBox1.value", I get the errors.
Do I have to declare every single Form Object in my page prior to the script
or is it something entirely different?

If anyone has an example of a VBScript code that includes Form Objects used
in a Form, could you please paste it in your reply?

Thanks
 
Back
Top