Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Mar 2005
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Form (limit characters) & (post to mult. email)

    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.

    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>

  • #2
    Regular Coder
    Join Date
    Jun 2002
    Posts
    626
    Thanks
    0
    Thanked 0 Times in 0 Posts
    How about this:
    Code:
    <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.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •