Object Required "txtPrice" 
Author Message
 Object Required "txtPrice"

Hi,

I'm developing a page that contains a few text input
boxes. I have a VBScript code that will calculate the
contents of the input boxes.

<INPUT TYPE=text NAME=textPrice VALUE="700">

<SCRIPT Language="VBScript">
Sub cmdCal_OnClick()
   msgbox txtPrice.Value
End Sub
</SCRIPT>

Hoever, when I click the button on the page, I get
this "object required" error...

Any help will be greatly appreciated.

Regards



Sun, 18 Jan 2004 11:32:18 GMT  
 Object Required "txtPrice"


Fri, 19 Jun 1992 00:00:00 GMT  
 Object Required "txtPrice"
rule 1 : don't use VBScript client-side. it's not interoperable. you're locking out Netscape, Mozilla, Opera, anything on a Mac, anything on Linux/Unix/BSD, basically anything non M$
rule 2 : qulaify your references

<INPUT TYPE=text NAME=textPrice VALUE="700">

<SCRIPT Language="VBScript">
Sub cmdCal_OnClick()
msgbox document.formnamehere.txtPrice.Value
End Sub
</SCRIPT>

which, in javascript, would be

<INPUT TYPE="text" NAME="textPrice" VALUE="700">
<input type="button" onclick="myFunction()">

<SCRIPT Language="JavaScript">
function myFunction()  {
alert(document.forms['formName'].elements['txtPrice'].Value);

Quote:
}

</SCRIPT>

Atrax

http://www.infinitemonkeys.ws/
http://www.sydneypubguide.net/
http://www.atrax.ws/

me : "RTFM"
you : "duh?"

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!



Sun, 18 Jan 2004 13:14:52 GMT  
 Object Required "txtPrice"


Fri, 19 Jun 1992 00:00:00 GMT  
 Object Required "txtPrice"
Use document.all.txtPrice.Value


Quote:
> Hi,

> I'm developing a page that contains a few text input
> boxes. I have a VBScript code that will calculate the
> contents of the input boxes.

> <INPUT TYPE=text NAME=textPrice VALUE="700">

> <SCRIPT Language="VBScript">
> Sub cmdCal_OnClick()
>    msgbox txtPrice.Value
> End Sub
> </SCRIPT>

> Hoever, when I click the button on the page, I get
> this "object required" error...

> Any help will be greatly appreciated.

> Regards



Sun, 18 Jan 2004 16:53:27 GMT  
 Object Required "txtPrice"
Check your spelling:
In <INPUT> tag, name=textPrice.
In your script you use txtPrice.   You're missing an 'e'.
Also, you may need to set the input tag's ID to textPrice
if it still gives you problems (if you want to use the
abbreviated reference)

Nathan Ernst



Sun, 18 Jan 2004 20:53:26 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. detecting "object required" or null object

2. detecting "object required" or null object

3. "Object Required" error

4. window.open - "Object required"

5. "Object Required" error

6. VBScript "Object Required WScript" Error

7. Error, Object Required "Wscript"

8. "Object Required" error

9. help: error 424 "Object Required"

10. "Object Required" in Visual Basic

11. Help: "Object Required" - error 424

12. "Object Required" for recordset

 

 
Powered by phpBB® Forum Software