Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript How-To
Javascript How-To Ask your "How do I do this with Javascript?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript How-To 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 May 19th, 2008, 08:34 PM
Wrox Author
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default JavaScript textarea problem with FireFox

Hello Everyone,
   I have been tolling over this for sometime now and I can't seem to find anything on google that pertains to this.

The long and the short of this is I have a form that has a single TEXTAREA contained within a hidden div. Based upon some logic this div is shown to the user with a value inserted into the TEXTAREA via javascript.

Now, there is a JavaScript wired up to the submit button that validates the TEXTAREA that it contains a comman sepearated list of email address's. The issue I am having is that, again based on some logic, the TEXTAREA may be prepopulated with a value via javascript. In IE if the user does not add any further text to the TEXTAREA and presses submit the javascript validates the information and process's the page as expected. In FireFox, however, the Javascript validation fails because it detects that the TEXTAREA is empty!

If the user types a single keystroke into TEXTAREA everything validates in FireFox without fail but, it seems FireFox is readining the TEXTAREA as having an empty value.

Here is my Javascript that I use, nothing real fancy:
    function CheckBulkEmail()
       var emailList = document.getElementById('<%=txtMultiEmail.ClientID %>').value;
       var emailArray = emailList.split(',');
       var regPattern =/^([a-zA-Z0-9_.-])+@([a-zA-Z0-9_.-])+\.([a-zA-Z])+([a-zA-Z])+/;

       for(i=0; i!=emailArray.length;i++)
             alert('The email address ' + emailArray[i] + ' is invalid. Please correct it before continuing!');
             return false;
       return true;

================================================== =========
Read this if you want to know how to get a correct reply for your question:
================================================== =========
.: Wrox Technical Editor / Author :.
Wrox Books 24 x 7
================================================== =========
Doug Parsons
Wrox online library: Wrox Books 24 x 7
Did someone here help you? Click on their post!
"Easy is the path to wisdom for those not blinded by themselves."

Similar Threads
Thread Thread Starter Forum Replies Last Post
Firefox vs. IE - Javascript problem VerbatimBOT ASP.NET 2.0 Professional 2 September 25th, 2008 03:28 AM
stop horizontal scrolling in textarea in Firefox 2 crmpicco CSS Cascading Style Sheets 1 October 13th, 2007 05:24 PM
Javascript - Firefox is not supporting lakshmi252002 General .NET 0 April 17th, 2007 12:14 AM
Firefox javascript error akkad Ajax 2 November 27th, 2006 10:57 AM

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