CodeCharge Studio
search Register Login  

Web Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> Archive -> GotoCode Archive

 field entry character limit?

Print topic Send  topic

Author Message
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

   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

MS Access to Web

Convert MS Access to Web.
Join thousands of Web developers who build Web applications with minimal coding.

CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.