Jamit Software Forum
Welcome, Guest. Please login or register.
August 04, 2021, 08:06:27 pm

Login with username, password and session length
Search:     Advanced search
May 27th, 2009 - Jamit Software Launches the forum today!
3,080 Posts in 791 Topics by 1,790,333 Members
Latest Member: Ramondrearly
* Home Help Search Login Register
+  Jamit Software Forum
|-+  Jamit Job Board Customers
| |-+  User-to-User Support
| | |-+  Set character limit on posting form
« previous next »
Pages: [1] Print
Author Topic: Set character limit on posting form  (Read 5345 times)
CompuDave
Global Moderator
Hero Member
*****
Posts: 173



WWW
« on: January 25, 2010, 12:54:23 pm »

I would like to set a limit on how many characters a user may enter per field on a form. ie Job Title on posting form - set max limit to avoid having long job title crammed with keywords.
Is this currently possible?
Logged
CompuDave
Global Moderator
Hero Member
*****
Posts: 173



WWW
« Reply #1 on: July 08, 2010, 12:56:11 pm »

Anyone have any input on this?
Logged
Banenpak
Global Moderator
Hero Member
*****
Posts: 100


« Reply #2 on: July 08, 2010, 01:15:36 pm »

Hello Compudave,

I gladly want to help you.
I look at it, but I can't give you an answer on you're question.

Sorry.

Someone else?

John de Vries
Logged
lee
Jammers
Sr. Member
*
Posts: 86



WWW
« Reply #3 on: July 08, 2010, 10:15:31 pm »

you can do it with javascript if you are familiar with it

Insert the following code into the page head:

<script language="javascript" type="text/javascript">
function limitText(limitField, limitCount, limitNum) {
   if (limitField.value.length > limitNum) {
      limitField.value = limitField.value.substring(0, limitNum);
   } else {
      limitCount.value = limitNum - limitField.value.length;
   }
}
</script>

Use the following code to create the form and text area (if necessary, change the name of the form and text area to suit your needs):

<form name="myform">
<textarea name="limitedtextarea" onKeyDown="limitText(this.form.limitedtextarea,this.form.countdown,100);"
onKeyUp="limitText(this.form.limitedtextarea,this.form.countdown,100);">
</textarea><br>
<font size="1">(Maximum characters: 100)<br>
You have <input readonly type="text" name="countdown" size="3" value="100"> characters left.</font>
</form>

thats how it done so you can play around with that and modify your own code with it, if you cant post your code here first

ps

To create a single-line text field instead of a text area, use the following code:

<form name="myform">
<input name="limitedtextfield" type="text" onKeyDown="limitText(this.form.limitedtextfield,this.form.countdown,15);"
onKeyUp="limitText(this.form.limitedtextfield,this.form.countdown,15);" maxlength="15"><br>
<font size="1">(Maximum characters: 15)<br>
You have <input readonly type="text" name="countdown" size="3" value="15"> characters left.</font>
</form>
« Last Edit: July 08, 2010, 10:17:13 pm by leeleeleelee » Logged
Pages: [1] Print 
« previous next »
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!
Page created in 0.033 seconds with 17 queries.