...

View Full Version : Textbox isnt an object problem



Borommakot
06-09-2004, 08:18 PM
Every time i try to run this script, it says that vname isnt an object. whats this mean?? Im trying to make a script that'll take the information from different inputs and arrange them in a message to e-mail to a certain recipiant. When i try to make the message come together, gives me an error message saying vname isnt an object. :confused: WHAT AM I DOING WRONG!?

<script language="javascript">
function message(form) {
nam=form.vname.value
date=form.dotw.value
hour=form.Hour.value
phr=form.ParH.value
AMP=form.AMP.value
pnum=form.pnumber.value
email=form.email.value
form.message.value="Hi Jim, it's " + nam + ". I wanted to schedule a lesson on " + date + " at " + hour + ":" + phr + " " + AMP + "/n/n &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -" + nam + "/n &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; " + pnumber + "/n &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; " + email
}
</script>





Here is the form where all of the inputs are located.






<form name="form" method="POST" action="--WEBBOT-SELF--">
<p>Your Name: <input type="text" name="vname" size="20"></input></p>
</form>

there is actually alot more to the form but i didnt want to post it all... i can post it tho.

Willy Duitt
06-09-2004, 08:46 PM
You do not show how you are calling the function.

onsubmit="message(this)"

Borommakot
06-09-2004, 09:01 PM
o sorry, :o its a button

<input type="button" onclick="message()" value="Create" name="Message">

heh, ima newbie to these forms :( sorry

Willy Duitt
06-09-2004, 09:04 PM
You need to pass the form thru the function.

onclick="message(this.form)"

But it would be best to use a submit button and the onsubmit I previously posted.

Borommakot
06-09-2004, 09:10 PM
DOH! i totally forgot lol, thanks. The submit that u posted, does that mail Just whats in the "message" text area? or the whole form?

Uh Oh... it says error
line 119
object doesnt support this property or method

but i dont have a line 119, just 70 lines

Willy Duitt
06-09-2004, 09:29 PM
The whole form. Which question leads be to assume that you are using more than one form and your "button" is in a different form. If so, that is your problem, but I am not going to continue to play twenty questions and/or guess.

Good Luck....

Borommakot
06-09-2004, 10:49 PM
Nope, im using just one form, and you could have the whole code if u want. but i dont think you want that. i still dont see how you assume that im using more than one form...

Mr J
06-10-2004, 02:23 PM
Please post the whole code

Borommakot
06-10-2004, 07:03 PM
o i got it working, nvm, but i'll show u the code, tell me what i did wrong plz. should i have called the function by

onchange="message(this.form)"

or

onkeypress="message(this.form)"

anyway, heres the code if u wanna tell me what i did wrong plz.


(btw this was a form to schedule lessons from a guy named jim :p )









<HTML>
<head>
<title>
Schedule Lessons
</title>
<script language="javascript">
function Message(form) {
nam=form.vname.value
date=form.dotw.value
hour=form.Hour.value
phr=form.ParH.value
AMP=form.AMP.value
pnum=form.pnumber.value
email=form.email.value
form.message.value="Hi Jim, it's " + nam + ". I wanted to schedule a lesson on " + date + " at " + hour + ":" + phr + " " + AMP + "/n/n &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -" + nam + "/n &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; " + pnumber + "/n &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; " + email
}
</script>
</head>
<body bgcolor="#FFFFFF">
<p>Schedule Lessons: </p>
<form name="FrontPage_Form1" method="POST" action="--WEBBOT-SELF--" onsubmit="message(this)">
<!--webbot bot="SaveResults" U-File="../_private/form_results.csv" S-Format="TEXT/CSV" S-Label-Fields="TRUE" startspan --><input TYPE="hidden" NAME="VTI-GROUP" VALUE="0"><!--webbot bot="SaveResults" i-checksum="43374" endspan -->
<p>Your Name: <input type="text" name="vname" size="20"></input></p>
<p>Your E-Mail Address: <input type="text" name="email" size="20"></p>
<p>Your Phone Number:
<input type="text" name="pnumber" size="20" value="(559) ___-____"></p>
<p>What day of the week did you want your lesson on?<!--webbot bot="Validation" b-value-required="TRUE" i-minimum-length="1" b-disallow-first-item="TRUE" --><select size="1" name="dotw">
<option>&lt;Select a day of the Week&gt;</option>
<option>Monday</option>
<option>Tuesday</option>
<option>Wednesday</option>
<option>Thursday</option>
<option>Friday</option>
<option>Saturday</option>
<option>Sunday</option>
<option>Any Week Day</option>
<option>Any Week End Day</option>
<option>Any Day</option>
</select> (You may select more than one if more than one choice appeals to
you by holding down ctrl and clicking on the second, third, fourth, or fifth option.)</p>
<p>What time do you prefer?<!--webbot bot="Validation" b-disallow-first-item="TRUE" --><select size="1" name="Hour">
<option>&lt;Select Hour&gt;</option>
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
<option>6</option>
<option>7</option>
<option>8</option>
<option>9</option>
<option>10</option>
<option>11</option>
<option>12</option>
</select>:<!--webbot bot="Validation" b-disallow-first-item="TRUE" --><select size="1" name="ParH">
<option>&lt;Select part of the hour&gt;</option>
<option>00</option>
<option>30</option>
</select> <!--webbot bot="Validation" b-disallow-first-item="TRUE" --><select size="1" name="APM">
<option>&lt;select AM or PM&gt;</option>
<option>AM</option>
<option>PM</option>
</select></p>
<p>Your message looks like this:</p>
<p><textarea rows="5" name="Message" cols="78"></textarea></p>
<p><input type="submit" value="Submit" name="Submit"><input type="reset" value="Reset" name="Reset"><input type="button" onclick="Message(this.form)" value="create Message" name="Create"></p>
</form>
</body>
</HTML>



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum