Results 1 to 3 of 3

Thread: Customising Form Field Limiter Script

  1. #1
    Join Date
    Apr 2008
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Customising Form Field Limiter Script

    1) Script Title: Form Field Limiter

    2) Script URL (on DD): http://www.dynamicdrive.com/dynamici...limitinput.htm

    3) Describe problem:

    I have installed the script on a page that allows the user to edit text fields from a database and it works as it should, however...

    When the page loads all the field limit display counters show the limit value specified when calling the displaylimit script, even when there is already text in the field.

    Can anyone advise how the script could be modified so that when it is called it checks to see how many characters are already in the related form field?

    Thanks,

    Chris.

  2. #2
    Join Date
    Aug 2004
    Posts
    10,143
    Thanks
    3
    Thanked 1,008 Times in 993 Posts
    Blog Entries
    16

    Default

    This is a rather old script, and ripe for a rewrite. But anyhow, in the meantime, you can do the above by finding the below line in the script:

    Code:
    var limit_text='<b><span id="'+theform.toString()+'">'+thelimit+'</span></b> characters remaining on your input limit'
    and changing that to:

    Code:
    var limit_text='<b><span id="'+theform.toString()+'">'+(thelimit-eval(theform).value.length)+'</span></b> characters remaining on your input limit'

  3. #3
    Join Date
    Apr 2008
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Perfect, thank you. My apologies for the late reply, forgot about my post here and must not have email alerts to new responses turned on in the forum cp.

Bookmarks

Posting Permissions

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