Miron
|
| Posted: 11/08/2002, 8:28 PM |
|
Hi everyone,
I just don't have a clue how to limit entry in the textbox of the record on 50 characters minimum.
Any suggestions welcome.
Thanx.
ASP-templates, MSaccess db.
|
|
|
 |
Edd
|
| Posted: 11/12/2002, 3:03 PM |
|
If you don't mind some JavaScript
1. Insert in Header Changing "NameofMyTextBox" to whatever you have called your textarea (carefull javascript is case sensitive).
----------------------------------------------------------
<script language="JavaScript"><!--
var maxKeys;
var keysSoFar;
var alerted;
var textarea;
maxKeys = 50; // limit of text allowed
keysSoFar = 0;
alerted = false;
function change(what) {
what.value = what.value.substring(0,maxKeys-1); // chop after limit
alerted = true;
}
function keyup(what) {
textarea = what.value;
keysSoFar = textarea.length;
NameofMyTextBox.CountChars.value = keysSoFar.toString();
if (keysSoFar > maxKeys) {
if (!alerted) alert('That's enough!');
what.value = what.value.substring(0,maxKeys-1); // chop the last typed char
NameofMyTextBox.CountChars.value = maxKeys.toString();
alerted = true;
}
}
//--></script>
--------------------------------------------------------------
Click on the Textbox and go to the Format Area of the properties tab an Click on the events +.
Scroll down to the onchange event and Type in: change(this)
Scroll down to the onkeyup event and Type in: keyup(this)
It is as simple as that.
Edd
|
|
|
 |
Nicole
|
| Posted: 11/14/2002, 6:27 AM |
|
Miron,
You can simple set maxlength="20" for <input> html tag
|
|
|
 |
|