| Author |
how to check null and empty values for a field ?
|
nirjari patel
Ranch Hand
Joined: Apr 23, 2009
Posts: 265
|
|
I have 10 fields in a form. these fields are to be displayed, hwen value is input by the user. Otherwise not. Now, whenever values are put in, those values are displayed. But when values are not supplied by the user, still bullets show up for all 10 fields. So how can I make sure that bullets and values show up only when there is value in the field. Someone told me to check the value as null and empty both. Still I get same result. I have checked null and empty values as follows. Please let me know, if its not correct and provide with the correct way of doing it.
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56528
|
|
Scriptlets? In 2009? Rethink.
What are the values of hr and lab when the page is being executed? Where are they defined? And do you really think that hr and lab are good variable names?
|
[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56528
|
|
Also,please be sure to use code tags when posting code to the forums. Unformatted code is extremely hard to read and many people that might be able to help you will just move along to posts that are easier to read. Please read this for more information.
You can go back and change your post to add code tags by clicking the button on your post.
|
 |
nirjari patel
Ranch Hand
Joined: Apr 23, 2009
Posts: 265
|
|
values for lab is e1 , e2 and e3 (Other 7 fields are blank) while those for the hr are e1.com, e2.com and e3.com
I have 10 fields as below
1 lab
hr
2 lab
hr
3 lab
hr
4 lab
hr
--
-
-
-
10 lab
hr
The fields for which there is no value entered by the user, shd not be displayed. So I have used
But still all the 10 bullets are displayed , whether values for those fields are entered or not. I want only those ones, for which values are entered
|
 |
ujjwal soni
Ranch Hand
Joined: Mar 28, 2007
Posts: 391
|
|
Hi Nirjari,
I have made some modifications to your code. check out my code below :
Hope this helps you........
|
Cheers!!!
Ujjwal B Soni <baroda, gujarat, india> <+919909981973>
"Helping hands are better than praying lips......"
|
 |
 |
|
|
subject: how to check null and empty values for a field ?
|
|
|