SitePoint Sponsor |
|
User Tag List
Results 1 to 5 of 5
Thread: If field is blank
-
Sep 10, 2006, 17:07 #1
- Join Date
- Jan 2006
- Posts
- 92
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
If field is blank
I am using javascript to detect if a field is left blank if (Col1.value == ""){return false}else{return confirm("Are you sure you want to add the following table? \n" + CheckTbl.value);} and if the form is left blank the form doesn't submit, but if I type a space in the field and submit the form it submits. How can I fix this issue?
-
Sep 10, 2006, 17:11 #2
- Join Date
- Sep 2006
- Location
- Oregon
- Posts
- 113
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Simply add a || and then detect for a " ".
I would use the function "trim()" to get rid of any spaces, then detect for a empty box.
Or both.
-
Sep 10, 2006, 17:28 #3
- Join Date
- Jan 2006
- Posts
- 92
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
But if I use trim and put My Column then wouldn't the trim make it output MyColumn? Is there a way to say if it doesn't contain a-z then return false?
-
Sep 10, 2006, 17:57 #4
- Join Date
- Jul 2003
- Location
- Melbourne, Australia
- Posts
- 579
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Originally Posted by HighCaliber
http://www.apriori-it.co.uk/Trim.asp
Regards,
Jordan
-
Sep 10, 2006, 18:04 #5
- Join Date
- Jan 2006
- Posts
- 92
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Thanks for your help bobber205 and J Windebank.
Bookmarks