Javascript : formname.body.value.length == 0 validation  
Author Message
planetparag





PostPosted: 2006-2-8 1:29:00 Top

java-programmer, Javascript : formname.body.value.length == 0 validation 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

 
Rhino





PostPosted: 2006-2-8 2:30:00 Top

java-programmer >> Javascript : formname.body.value.length == 0 validation
"planetparag" <email***@***.com> wrote in message
news:email***@***.com...
> 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.



 
Oliver Wong





PostPosted: 2006-2-8 4:03:00 Top

java-programmer >> Javascript : formname.body.value.length == 0 validation
"Rhino" <email***@***.com> wrote in message
news:fG5Gf.2399$J%email***@***.com...
>
> "planetparag" <email***@***.com> wrote in message
> news:email***@***.com...
>> 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.

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


 
 
Rhino





PostPosted: 2006-2-8 13:01:00 Top

java-programmer >> Javascript : formname.body.value.length == 0 validation
"Oliver Wong" <email***@***.com> wrote in message
news:K17Gf.180805$6K2.177417@edtnps90...
>
> "Rhino" <email***@***.com> wrote in message
> news:fG5Gf.2399$J%email***@***.com...
>>
>> "planetparag" <email***@***.com> wrote in message
>> news:email***@***.com...
>>> 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.
>
> 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.