View Full Version : Customising Form Field Limiter Script

04-07-2008, 04:20 PM
1) Script Title: Form Field Limiter

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex16/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?



04-07-2008, 05:27 PM
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:

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

and changing that to:

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

05-12-2008, 10:09 AM
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.