WSN Gallery
Featuresspacer Showcasespacer Reviewsspacer Demosspacer Purchasespacer Manualspacer Support
Adding Character Limits to Other Fields
Adding Character Limits to Other Fields

THIS IS NOT WORKING AS IS. CHANGES WILL BE MADE IN THE NEXT FEW DAYS TO CORRECT THE PROBLEMS.

In your suggest a image and edit image templates/pages, the description field is limited to 500 or 1000 characters by default (depending on your version). To change the number of characters that this field is limited to you simply go to the Manage Settings area of the admin panel and you can set this number to whatever value you like.

But what if you would like to do the same thing with the title, member name or any other field you may have in your forms?

What you can do is add additional settings fields that will allow you to add this feature to virtually any form field you like.

First add a settings field name for the fields you want to limit. Then you can go in and input the value for the number of characters you want in that field.

Second (optional) you may want to edit your settings template to move the new fields up into your template in the same area where the description one is now.

Third copy the code in the edit or suggest template and place the same code in the fields where you want to limit the character input.

This is the code:
<td class="optionscolumn"><textarea cols="45" rows="5" name="description" onKeyDown="textCounter(editform.description,editform.remLen,1000);" onKeyUp="textCounter(editform.description,editform.remLen,1000);">{LINKDESCRIPTION}</textarea>
<br><input readonly type="text" name="remLen" size="4" maxlength="4" value="1000"> characters remaining
</td>

Fourth replace the description variable with the new variable you created for this field.

Replace 1000 with 50 or which ever name you have chosen. Plus make sure to correct all of the areas in red for the new field. You may also need to change the form input information to correspond with the field you are adding this feature.

Fifth do the same thing in the corresponding template edit/suggest.

Last if you are adding this to one of the member templates or some place where the description field does not already appear you will need to copy and the javascript to the top of the template. It only needs to appear once per template so if it is already there no need to add it again.

This is the javascript code:
<script type="text/javascript" language="JavaScript">
<!-- Begin
function textCounter(field, countfield, maxlimit) {
if (field.value.length > maxlimit)
field.value = field.value.substring(0, maxlimit);
else
countfield.value = maxlimit - field.value.length;
}
// End -->
</script>

Rating:


0/5 based on 0 votes. The median rating is 0.

Submitted: 12/15/03 (Edited 01/12/04)

Description: Limiting the number of character in other fields of your form.

Views: 1171 views. Averaging 1 per day.
In the most recent 30 day period, there've been 0 views.

Previous Article | Next Article

Home    |    Features    |    Showcase    |    Reviews    |    Demos    |    Purchase    |    Manual    |    Support