Javascript : formname.body.value.length == 0 validation

P

planetparag

Hi,
We have a J2EE application which had jsp's that represent a form. When
we submit the jsp's the form is converted into a mail and is sent using
a mail server.
In the jsp there is a validation where we check for the length of the
body using the following:
if (formname.body.value.length == 0)
{
isFormComplete = false;
}

Need to know which are the possible cases when the length of the form
could be '0'.
The behaviour is real weird. Roughly 2 out of 10 times the length comes
as 0 even when the user enters all the details. What could be the
reason for the same ?
Any pointers are highly appreciated.

Regards,
Parag
 
R

Rhino

planetparag said:
Hi,
We have a J2EE application which had jsp's that represent a form. When
we submit the jsp's the form is converted into a mail and is sent using
a mail server.
In the jsp there is a validation where we check for the length of the
body using the following:
if (formname.body.value.length == 0)
{
isFormComplete = false;
}

Need to know which are the possible cases when the length of the form
could be '0'.
The behaviour is real weird. Roughly 2 out of 10 times the length comes
as 0 even when the user enters all the details. What could be the
reason for the same ?
Any pointers are highly appreciated.
The only pointer I have is that you are on the wrong newsgroup; you want
comp.lang.javascript. Despite the similarity in names, Java and JavaScript
have nothing to do with one another and aren't even owned by the same
companies. It's just an unfortunate coincidence that confuses people.
 
O

Oliver Wong

Rhino said:
The only pointer I have is that you are on the wrong newsgroup; you want
comp.lang.javascript. Despite the similarity in names, Java and JavaScript
have nothing to do with one another and aren't even owned by the same
companies. It's just an unfortunate coincidence that confuses people.

What's funny is that the OP doesn't ever actually mention JavaScript in
the body of the message. That if-statement could very well be JSP code, in
which case this might actually be the correct newsgroup after all, or it
could be JavaScript code, where it is inappropriate here.

The OP should clarify whether the code (s)he quoted is located in the
generated HTML that the browser sees, or is hidden in the JSP code on the
server side.

- Oliver
 
R

Rhino

Oliver Wong said:
What's funny is that the OP doesn't ever actually mention JavaScript in
the body of the message. That if-statement could very well be JSP code, in
which case this might actually be the correct newsgroup after all, or it
could be JavaScript code, where it is inappropriate here.

The OP should clarify whether the code (s)he quoted is located in the
generated HTML that the browser sees, or is hidden in the JSP code on the
server side.
You are absolutely right.

I don't do JSPs, just servlets, so I assumed the subject line indicated a
pure JavaScript question. But if that syntax is valid in JSPs, then the
question might belong here after all.

The OP definitely needs to clarify the question if he/she intends it to be
answered here.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,599
Members
45,175
Latest member
Vinay Kumar_ Nevatia
Top