Click to See Complete Forum and Search --> : If document.form.textbox.value=""


IxxI
03-18-2003, 07:37 AM
I have two rows of textboxes. The output from these (user entered) is displayed in a textarea. However if the second row is not filled in I don't want blanks to be displayed in the textarea. So I put in a test:
If (document.form.textbox.value="")
(then only display the first row)
else
(display both)
Obviously the textbox in question is on the second row. However even when there is nothing on the second row it still displays both rows results. Why does this happen?
Even if I try "alerting" the value it seems to have nothing in it. Is there a value automatically given to an empty textbox or is something else wrong?
Thanks,

IxxI

gil davis
03-18-2003, 07:50 AM
Is this a typo?If (document.form.textbox.value="")should be If (document.form.textbox.value=="")Note the double equal signs for comparison. Otherwise, it is an equate.

IxxI
03-18-2003, 08:00 AM
Now I feel really stupid. I'd have thought I might have noticed that when pasting it in here but obviuosly not. Thanks Gil, it now works. I checked everything as well!! My excuse is I'm tired. Or at least thats what I'll say...

IxxI

pyro
03-18-2003, 08:08 AM
Is that the same excuse as to why you named a form "form"? :p I would recommend never doing that....

IxxI
03-18-2003, 11:02 AM
I didn't. I just thought for clarity it might be better. ;)

IxxI