Click to See Complete Forum and Search --> : document.open or location.href?


screamingbuddha
12-05-2002, 11:37 AM
I'm doing a simple form validation which requires the user to answer all questions.. if a question is left blank, I need a new page to reload into the same window..

have tried, but not working:

if ((f1 == null) || (f2 == null) || (f3 == null) || (f4 == null) ) {
location.href="/error.html";
}
else { stuff }

and also

if ((f1 == null) || (f2 == null) || (f3 == null) || (f4 == null) ) {
document.open("/error.html");
}
else { stuff }

neither one seems to work, any help?

gil davis
12-05-2002, 02:16 PM
Originally posted by screamingbuddha if ((f1 == null) || (f2 == null) || (f3 == null) || (f4 == null) ) {

Instead of trying to give you an answer (an impossible task without the entire file), I'm going to tell you how to debug it yourself.

In the function that you think is going to validate your form, insert the following statement:

alert(typeof f1 + " value = " + f1);

When you've done that, and you can't figure out what your error is, come back.

I suspect your results will either be

[object]

or

undefined