problem with text area....

J

jodleren

I have some problems, which a textarea, and I dont get it. I look
briefly here, but failed to find an answer

The code just does not work:

<body onload="documents.forms[0].elements['txtMessage'].focus();">
<- it never gets focus
<form ACTION="" METHOD="POST" name="formMain" onsubmit="return mysubmit
(this);">

and this return always true:


function mysubmit(frm)
{
if(this.submitted)
return false;
else
{
if((frm.elements['txtMessage'].Value=="") || (frm.elements
['txtMessage'].Value=="undefined"))
{
alert("The description is missing!");
return false;
}
else
{
this.submitted=true;
Submit.Disabled=true;
Submit2.Disabled=true;
return true;
}
}
}

I tried to set focus and the end of the file, and the result is the
same - my problem is clealy that I have a textarea.

WBR
Sonnich
 
J

jodleren

I should mention, that

alert(frm.elements['txtMessage'].Value); really gives the content of
it, unless it is empty, then I get "undefined"

WBR
sonnich
 
E

Evertjan.

jodleren wrote on 28 okt 2009 in comp.lang.javascript:

[please always quote on usenet]
alert(frm.elements['txtMessage'].Value); really gives the content of
it, unless it is empty, then I get "undefined"

I do not believe it.

..Value not .value ?
 
J

jodleren

I should mention, that

alert(frm.elements['txtMessage'].Value); really gives the content of
it, unless it is empty, then I get "undefined"

WBR
sonnich

I found the s in documenets :)
Still, I dont get it for validation

alert(frm.elements['txtMessage'].Value==undefined); // always true
alert((frm.elements['txtMessage'].Value+"")==""); // always true
alert(frm.elements['txtMessage'].name); // works :)

I get the component, but not the value. Why?

WBR
Sonnich
 
J

jodleren

jodleren wrote on 28 okt 2009 in comp.lang.javascript:

[please always quote on usenet]
alert(frm.elements['txtMessage'].Value); really gives the content of
it, unless it is empty, then I get "undefined"

I do not believe it.

.Value not .value ?

yeah..... I need new glasses or a break
 
E

Evertjan.

jodleren wrote on 28 okt 2009 in comp.lang.javascript:
I should mention, that

alert(frm.elements['txtMessage'].Value); really gives the content of
it, unless it is empty, then I get "undefined"

WBR
sonnich

I found the s in documenets :)
Still, I dont get it for validation

alert(frm.elements['txtMessage'].Value==undefined); // always true
alert((frm.elements['txtMessage'].Value+"")==""); // always true
alert(frm.elements['txtMessage'].name); // works :)

I get the component, but not the value. Why?

try:

<form>
<textarea name='txtMessage'>
abc
</textarea>
</form>

<script type='text/javascript'>

var frm = document.forms[0];

alert(frm.elements['txtMessage'].Value); // undefined
alert(frm.elements['txtMessage'].value); // abc

</script>
 

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

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,065
Latest member
OrderGreenAcreCBD

Latest Threads

Top