Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

 
 
Thread Tools Display Modes
Prev Previous Post in Thread   Next Post in Thread Next
Old Dec 31st, 2005, 10:17 PM   #1
aznluvsmc
Hobbyist Programmer
 
Join Date: Aug 2005
Posts: 137
Rep Power: 4 aznluvsmc is on a distinguished road
How to check a <textarea> field in Javascript?

Hi,

I created a little form on my website that contains a textarea for users to enter comments. Upon clicking submit, my validation function will check various things. I would like to check to see if the user entered anything in the comments section. If they didn't, I'd like to pop-up a confirm dialog box asking if they're sure they want to submit with no comments.

The problem is that I'm not sure how the if condition should look like to check the field. I tried the following but it doesn't seem to work. The <textarea> is named comment and there is no default value for it.

if (form.comment.value == "") {
     answer = confirm("No comments entered, are you sure?");
     }
aznluvsmc is offline   Reply With Quote
 

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 10:50 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC