Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 4 > BOOK: Beginning ASP.NET 4 : in C# and VB
|
BOOK: Beginning ASP.NET 4 : in C# and VB
This is the forum to discuss the Wrox book Beginning ASP.NET 4: in C# and VB by Imar Spaanjaars; ISBN: 9780470502211
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 4 : in C# and VB section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 9th, 2010, 05:01 PM
Registered User
 
Join Date: Dec 2010
Posts: 2
Thanks: 2
Thanked 0 Times in 0 Posts
Default after adding Javascript on page 312 get error:object expected

for some reason this code is not working for me...I get "Error:Object expected"

do you see an error?


Code:
<script type= "text/javascipt">
function ValidatePhoneNumbers (source, args)
{
    var phoneHome = document.getElementByID('<%= PhoneHome.ClientID %>');
    var phoneBusiness = document.getElementById('<%= PhoneBusiness.ClientID %>');
    if (phoneHome.value !='' || phoneBusiness.value !='')
    { 
    args.IsValid = true;
    }
    else
    {
    args.IsValid = false;
    }
 }

</script>
 
Old December 9th, 2010, 06:07 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi there,

Take a look at how you spell getElementById. In one line you use getElementByID, and in the other you use getElementById. It should be getElementById.

Hope this helps,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
 
Old December 9th, 2010, 06:08 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Also, it's

<script type="text/javascript">

instead of

<script type= "text/javascipt">


Cheers,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
The Following User Says Thank You to Imar For This Useful Post:
volfandt (December 10th, 2010)
 
Old December 10th, 2010, 01:33 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Haha, I noticed you deleted your previous message. I guess you figured out its Id, not id... ;-) Darn case-sensitive languages.....

Cheers,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
The Following User Says Thank You to Imar For This Useful Post:
volfandt (December 10th, 2010)
 
Old December 10th, 2010, 02:38 PM
Registered User
 
Join Date: Dec 2010
Posts: 2
Thanks: 2
Thanked 0 Times in 0 Posts
Default

thanks .. i really appreciate your help....love the book.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Object Expected Error bccliff Ajax 4 July 25th, 2009 03:37 AM
Getting Object Expected error on mouseover event nrlahoti ASP.NET 2.0 Professional 10 March 15th, 2008 11:30 AM
Object expected error hericles Javascript How-To 1 July 19th, 2007 10:21 AM
error on page: object expected eggoose Javascript 5 April 19th, 2006 02:14 AM
run time error: Object expected shoakat Classic ASP Databases 5 September 22nd, 2004 03:17 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.