Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / August 2007

Tip: Looking for answers? Try searching our database.

Firefox issue with ASPNET AJAX

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Showjumper - 02 Aug 2007 23:38 GMT
Hi,
I am using ASP.NET AJAX to check username availability in a registration
form. Everything works fine in IE but not in FF. Using Firebug, i can find
the offending line but not sure what to about it. The error firebug gives
txtUsername has no properties. Not sure how to fix this. Thank you for any
help.

var txtUserName;

function pageLoad()

{

txtUserName = $get("<%=Username.UniqueID %>");

}

function CheckUserName()

{

if (txtUserName.value.length > 0)

{

$get("imgWaitingUsername").style.display = 'inline';

$get("spanUsername").innerHTML = 'Checking Username Availability...';

$get("spanUsername").style.color = "red";

$get("spanUsername").style.fontWeight = "bold";

PageMethods.CheckUserName(txtUserName.value, OnCheckUserName);

}

else

$get("spanUsername").innerHTML= "";

reqvalUsername.innerHTML = "Username is required";

}
Laurent Bugnion, MVP - 03 Aug 2007 07:59 GMT
Hi,

> Hi,
> I am using ASP.NET AJAX to check username availability in a registration
> form. Everything works fine in IE but not in FF. Using Firebug, i can find
> the offending line but not sure what to about it. The error firebug gives
> txtUsername has no properties. Not sure how to fix this. Thank you for any
> help.

Which is the offending line?

You have a missing '{' on the line indicated by "HERE" (see below).

You should really start to indent your code and use a consistent code
guideline, it would make your code easier to read and to debug.

HTH,
Laurent

> var txtUserName;
>
[quoted text clipped - 27 lines]
>
> else

HERE

> $get("spanUsername").innerHTML= "";
>
> reqvalUsername.innerHTML = "Username is required";
>
> }

Signature

Laurent Bugnion [MVP ASP.NET]
Software engineering, Blog: http://www.galasoft.ch
PhotoAlbum: http://www.galasoft.ch/pictures
Support children in Calcutta: http://www.calcutta-espoir.ch

Showjumper - 03 Aug 2007 13:53 GMT
Error in Firebug is txtUserName has no properties. Offending line appears to
be
if (txtUserName.value.length > 0)
Took care of the missing bracket and it still does not work in FF but works
in IE.
Also My code IS indented in VS.
> Hi,
>
[quoted text clipped - 54 lines]
>>
>> }
Laurent Bugnion, MVP - 03 Aug 2007 16:27 GMT
Hi,

> Error in Firebug is txtUserName has no properties. Offending line appears to
> be
> if (txtUserName.value.length > 0)

That error means that the control named after "<%=Username.UniqueID %>"
doesn't exist on your page. It's null, so when you try to access the
"value" property, it throws an error.

You must find why there is no such control on your produced page. Try to
view the produced HTML source (on the web client) and see if it's here.

> Took care of the missing bracket and it still does not work in FF but works
> in IE.

That's rather surprising for this error. Compare the produced HTML code
in IE and in Firefox. Do you see differences?

> Also My code IS indented in VS.

OK, that's good. I use "Insert spaces" instead of "Keep tabs" in the
"Text editor" options in VSto avoid this kind of annoyance when I
copy/paste code.

HTH,
Laurent
Signature

Laurent Bugnion [MVP ASP.NET]
Software engineering, Blog: http://www.galasoft.ch
PhotoAlbum: http://www.galasoft.ch/pictures
Support children in Calcutta: http://www.calcutta-espoir.ch

Showjumper - 03 Aug 2007 23:04 GMT
Fixed the issue: it was the Unique ID reference which worke din IE but not
in FF.
> Hi,
>
[quoted text clipped - 23 lines]
> HTH,
> Laurent
Showjumper - 03 Aug 2007 23:19 GMT
Thanks for your help.
> Hi,
>
[quoted text clipped - 23 lines]
> HTH,
> Laurent

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.