...

View Full Version : Form (limit characters) & (post to mult. email)



meanpplsuk
03-10-2005, 05:30 PM
Here is what I am trying to accomplish: I want it so that when I get a service call, it posts to my phone email, and sends a carbon copy to my office email. The characters have to be limited because my provider limits the message my phone can receive.
:confused:
I am new to Javascript and need a little help editing a script I found. What I would like for it to do is to limit: the account number field to 4 characters, last name field to 12 characters....etc. Also how do you tell it to submit to 2 email addresses?

This is what I found:

Thanks in advance!


<HTML>
<HEAD>
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
function textCounter(field, countfield, maxlimit) {
if (field.value.length > maxlimit) // if too long...trim it!
field.value = field.value.substring(0, maxlimit);
// otherwise, update 'characters left' counter
else
countfield.value = maxlimit - field.value.length;
}

// End -->

</SCRIPT>

</HEAD>

<BODY>

<!-- textCounter() parameters are: text field, the count field, max length -->

<center>

<form name=myform action="mailto:white_zombie_stang@yahoo.com" method="post" enctype="text/plain" >
<font size="1" face="arial, helvetica, sans-serif">

Please include the following in the order provided:<br>
Account#<br>
Last name<br>
Address<br>
Phone number<br>
Panel type<br>
Work to be performed<br>

<textarea name=message wrap=physical cols=4 rows=4 onKeyDown="textCounter(this.form.message,this.form.L n,85);" onKeyUp="textCounter(this.form.message,this.form.Ln ,85);"></textarea>
<br>

<input readonly type=text name=Ln size=3 maxlength=3 value="85"> characters left</font>

<input type="submit" value="Submit">
</form>

</center>
</BODY>
</HTML>

requestcode
03-10-2005, 06:07 PM
How about this:


<HTML>
<HEAD>
<SCRIPT type="text/javascript">
<!-- Begin
function textCounter(field,countfield,maxlimit) {
if (field.value.length > maxlimit){ // if too long...trim it!
field.value = field.value.substring(0, maxlimit);
alert("Maximun number of characters reached!")
}
countfield.value=parseInt(maxlimit-field.value.length)
}

// End -->

</SCRIPT>

</HEAD>

<BODY>

<!-- textCounter() parameters are: text field, the count field, max length -->

<center>

<form name=myform action="mailto:white_zombie_stang@yahoo.com" method="post" enctype="text/plain" >
<font size="1" face="arial, helvetica, sans-serif">

Please include the following in the order provided:<br>
Account#<br>
Last name<br>
Address<br>
Phone number<br>
Panel type<br>
Work to be performed<br>

<textarea name=message wrap=physical cols=4 rows=4 wrap="hard" onKeyPress="textCounter(this.form.message,this.form.Ln,85)"></textarea>
<br>

<input readonly type=text name=Ln size=3 maxlength=3 value="85"> characters left</font>

<input type="submit" value="Submit">
</form>

</center>
</BODY>
</HTML>


You should also know that most browsers do not accept using "mailto:" in the action field. You don't get an error it just won't email the form. You should use a serverside program to process it.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum