Results 1 to 5 of 5

Thread: Control the number of letters of a text area ?

  1. #1
    Join Date
    Aug 2002
    Location
    Germany
    Posts
    1,180

    Default Control the number of letters of a text area ?

    Hello,

    I set up some new link fields like:
    Long description (for detail page), suggest a category and comment to staff and now I'm searching to control the numer of letters the users can add with his link.

    Description field should be short and long description could be longer.
    With an input field this is no problem with "maxlenght", but with a text area this won't work.
    I found some javascripts in the web, but they all didn't use the "name-field" to give the variable to the script or I can't use twice of them in one form.

    Did someone something like this or has good idea how to do this ?

    Greetings
    Frank

  2. #2
    Join Date
    Aug 2001
    Location
    Indonesia
    Posts
    3,732

    Default

    It's about custom field. Please read tech note for basic use of it. Frank, I think you should prevent indexu generate custom field form for your add.php and modify.php. Just delete tag <%custom_field_form%> in add_form.html and modify_form.html to do this. Then see the result.

    You'll see indexu do not generate form field for custom fields. You must do it yourself manually in add_form.html and modify_form.html.
    PHP Code:
    <textarea cols="80" rows="20" name="your_custom_field_name">
    <%
    your_custom_field_name%>
    </
    textarea

  3. #3
    Join Date
    Aug 2002
    Location
    Germany
    Posts
    1,180

    Default textarea

    Hello Dody,

    sorry, this is not what I mean.
    To change this is easy. For example if I have a text area with row=5 and col=5 -> this is not important for the user -> row and col is only the size of what a user can see.
    If he write more, the window will scroll.

    So I can't control how much they submit and I have to rework a lot of links, because they wrote 1000 instead of 100 letters.

    Try it and you will see what I mean.

    The only way I know is to set a maximum of letters to the field in database, but then I can't write more, too and it is not so fine for the user.

    Better is a count back counter and a maximum like you can see by a lot of free sms services.
    But I don't know how to do this for indexu and for more then one field in a form.

    Greetings
    Frank

  4. #4
    Join Date
    Aug 2002
    Location
    Germany
    Posts
    1,180

    Default Thats it !

    Best wishes to Heiko !

    Here you find a great small script to control all your text areas:

    http://www.dynamicdrive.com/dynamici...limitinput.htm

    I did a first test it seems to work well with V3.1.
    But better you take a third header for the add.php.

    Greetings
    Frank

  5. #5
    Join Date
    Aug 2001
    Location
    Indonesia
    Posts
    3,732

    Default

    Yes, you should use java script that have real time control. PHP nor other server side scripting can't do this.

Posting Permissions

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