Valid script does not work with Scripting Object Model 
Author Message
 Valid script does not work with Scripting Object Model

I have tested the following sample script (taken from MSDN) and it worked
fine:

<SCRIPT LANGUAGE="VBScript">
<!--
Sub btnEnter_OnClick
  Dim TheForm
  Set TheForm = Document.MyForm
  If IsNumeric(TheForm.Age.Value) Then
    TheForm.submit
  Else
    Msgbox "Please enter a numerical age."
  End if
End Sub
file://-->
</SCRIPT>

<FORM  METHOD= "POST" NAME= MyForm  ACTION="myfile.asp"  >
Name: <INPUT TYPE="text" NAME="Name" >
Age:  <INPUT TYPE="text" NAME="Age" >
<INPUT TYPE="button" NAME="btnEnter"  VALUE="Enter">
</FORM>

But when I have enabled Scripting Object Model, I received an error saying
that MyForm is not an object, and the script did not worked.
What went wrong, and how this problem can be solved?



Sun, 08 Sep 2002 03:00:00 GMT  
 Valid script does not work with Scripting Object Model
I have tested the following sample script (taken from MSDN) and it worked
fine:

<SCRIPT LANGUAGE="VBScript">
<!--
Sub btnEnter_OnClick
  Dim TheForm
  Set TheForm = Document.MyForm
  If IsNumeric(TheForm.Age.Value) Then
    TheForm.submit
  Else
    Msgbox "Please enter a numerical age."
  End if
End Sub
file://-->
</SCRIPT>

<FORM  METHOD= "POST" NAME= MyForm  ACTION="myfile.asp"  >
Name: <INPUT TYPE="text" NAME="Name" >
Age:  <INPUT TYPE="text" NAME="Age" >
<INPUT TYPE="button" NAME="btnEnter"  VALUE="Enter">
</FORM>

But when I have enabled Scripting Object Model, I received an error saying
that MyForm is not an object, and the script did not worked.
What went wrong, and how this problem can be solved?



Mon, 09 Sep 2002 03:00:00 GMT  
 Valid script does not work with Scripting Object Model
I've never used SOM (and probably never will ;-) but try quoting the name value...

NAME="MyForm"

--
Michael Harris
MVP Scripting

I have tested the following sample script (taken from MSDN) and it worked
fine:

<SCRIPT LANGUAGE="VBScript">
<!--
Sub btnEnter_OnClick
  Dim TheForm
  Set TheForm = Document.MyForm
  If IsNumeric(TheForm.Age.Value) Then
    TheForm.submit
  Else
    Msgbox "Please enter a numerical age."
  End if
End Sub
file://-->
</SCRIPT>

<FORM  METHOD= "POST" NAME= MyForm  ACTION="myfile.asp"  >
Name: <INPUT TYPE="text" NAME="Name" >
Age:  <INPUT TYPE="text" NAME="Age" >
<INPUT TYPE="button" NAME="btnEnter"  VALUE="Enter">
</FORM>

But when I have enabled Scripting Object Model, I received an error saying
that MyForm is not an object, and the script did not worked.
What went wrong, and how this problem can be solved?



Mon, 09 Sep 2002 03:00:00 GMT  
 Valid script does not work with Scripting Object Model
I have found the solution in the MSDN Knowledge Base: "HOWTO: Enable the SOM
on an ASP That Has a <Form> Tag" (ID: Q232218)
They say that enabeling SOM define a form "thisForm" and probably it is not
possible to define a form within form, so what you have to do is using this
form ("thisForm" form), and not define user form. I have tried it and it
works


Quote:
> I've never used SOM (and probably never will ;-) but try quoting the name
value...

> NAME="MyForm"

> --
> Michael Harris
> MVP Scripting




Quote:
> I have tested the following sample script (taken from MSDN) and it worked
> fine:

> <SCRIPT LANGUAGE="VBScript">
> <!--
> Sub btnEnter_OnClick
>   Dim TheForm
>   Set TheForm = Document.MyForm
>   If IsNumeric(TheForm.Age.Value) Then
>     TheForm.submit
>   Else
>     Msgbox "Please enter a numerical age."
>   End if
> End Sub
> file://-->
> </SCRIPT>

> <FORM  METHOD= "POST" NAME= MyForm  ACTION="myfile.asp"  >
> Name: <INPUT TYPE="text" NAME="Name" >
> Age:  <INPUT TYPE="text" NAME="Age" >
> <INPUT TYPE="button" NAME="btnEnter"  VALUE="Enter">
> </FORM>

> But when I have enabled Scripting Object Model, I received an error saying
> that MyForm is not an object, and the script did not worked.
> What went wrong, and how this problem can be solved?



Sun, 15 Sep 2002 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Valid script does not work with Scripting Object Model

2. Script works, script don't work

3. VB5 and Windows Scripting Host Object Model

4. Windows Script Host Shell Object (Malacious script detected)

5. 'Remote Scripting Error: Page invoked does not support remote scripting

6. Error: ActiveX Scripting was not able to initialize the script execution engine

7. Accessing script variables through the script object

8. New To Scripting and Script does not work

9. New To Scripting and Script does not work

10. The script does not work all the time

11. script is not working

12. Creating a user via script - not working

 

 
Powered by phpBB® Forum Software