SMS Contact form - limit characters to 140

Discussion in 'HTML' started by ©®, Mar 25, 2009.

  1. ©®

    ©® Guest

    I am wanting to have a contact form on my website so friends can email
    me. This si working great and I receive their comments.
    I thought it would be a great idea to add the ability that they could
    send me a text message as well, but realised I would need to limit the
    text input to about 140 characters.
    Does anyone have a tutorial on how I could do this please? I would like
    to be able to decide what the total character limit is e.g. 140 or 200
    or whatever I choose.
    Thanks very much.
    PS - Having a counter show in real-time how many characters are
    available to type would be very helpful.
    ©®, Mar 25, 2009
    #1
    1. Advertising

  2. ©®

    ©® Guest

    Just to add, the message would be sent via email (not an SMS gateway) to
    an ATT phone so the message would get sent to

    It is the showing how many characters and limiting the characters that I
    need help on how to do it.
    ©®, Mar 25, 2009
    #2
    1. Advertising

  3. ©®

    J.O. Aho Guest

    Jerry Stuckle wrote:
    > ©® wrote:
    >> Just to add, the message would be sent via email (not an SMS gateway)
    >> to an ATT phone so the message would get sent to
    >>
    >> It is the showing how many characters and limiting the characters that
    >> I need help on how to do it.
    >>

    >
    > Just use strlen() to determine the length; if it's over the limit,
    > redisplay the form with an error message (and the original text).
    >
    > You can also limit it client-side - but that's a javascript problem.
    >


    and of course, doing the check only client side is a bad way to do things.


    In case the OP did miss, SMS are sent in multiples of 160 characters, so a
    limit of 140 or 200 as in the original post is a waste of money, it's better
    to use the message fully.

    --

    //Aho
    J.O. Aho, Mar 25, 2009
    #3
  4. ©® wrote:
    > I am wanting to have a contact form on my website so friends can email
    > me. This si working great and I receive their comments.
    > I thought it would be a great idea to add the ability that they could
    > send me a text message as well, but realised I would need to limit the
    > text input to about 140 characters.
    > Does anyone have a tutorial on how I could do this please? I would like
    > to be able to decide what the total character limit is e.g. 140 or 200
    > or whatever I choose.
    > Thanks very much.
    > PS - Having a counter show in real-time how many characters are
    > available to type would be very helpful.
    >
    >

    <input type="text" maxlength="140" ...>
    Harlan Messinger, Mar 25, 2009
    #4
  5. ©® wrote:
    > I am wanting to have a contact form on my website so friends can email
    > me. This si working great and I receive their comments.
    > I thought it would be a great idea to add the ability that they could
    > send me a text message as well, but realised I would need to limit the
    > text input to about 140 characters.
    > Does anyone have a tutorial on how I could do this please? I would like
    > to be able to decide what the total character limit is e.g. 140 or 200
    > or whatever I choose.


    On the server size have the script, I am assuming PHP since you have
    alt.php included, limit the posted input to 'n' characters...

    $limit = 200; //set to whatever you want to limit the string to...
    // be sure to filter, NEVER trust user input!
    $message = (YourFunctionToSanitizeInput($_POST['message']), 0, $limit);


    > PS - Having a counter show in real-time how many characters are
    > available to type would be very helpful.


    Of course it will only work with JavaScript enabled, but not to hard to
    attached a JS function to onkeyup of the textarea that counts the
    content characters then updates a text node with the results.

    --
    Take care,

    Jonathan
    -------------------
    LITTLE WORKS STUDIO
    http://www.LittleWorksStudio.com
    Jonathan N. Little, Mar 25, 2009
    #5
  6. ©®

    ©® Guest

    > In case the OP did miss, SMS are sent in multiples of 160 characters,
    > so a
    > limit of 140 or 200 as in the original post is a waste of money, it's
    > better
    > to use the message fully.


    Yeah - I did know that, but just chose 140 and 200 as ewxamples. I
    thought that if it is 140, then any name, subjects etc. might make up
    the 160.

    I am a total newbie so will have to search out an example as I don't
    know how to program php yet.
    ©®, Mar 25, 2009
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. John
    Replies:
    0
    Views:
    901
  2. John
    Replies:
    0
    Views:
    1,006
  3. Great Job
    Replies:
    0
    Views:
    413
    Great Job
    Feb 9, 2008
  4. freesms
    Replies:
    0
    Views:
    363
    freesms
    May 11, 2008
  5. Brynn
    Replies:
    1
    Views:
    543
    Brynn
    Jan 19, 2004
Loading...

Share This Page