Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

HTML Forum


You are currently viewing our HTML Forum as a guest. Please register to participate.
Login



Post a Project »

Find a Professional HTML Freelancer!

Find a Freelancer to help you with your HTML projects

FREE Outsourcing eBook!

Reply
Old 03-27-2005, 06:48 PM Limit Textbox
coolnyc's Avatar
Skilled Talker

Posts: 97
Location: Queens, NY
Trades: 0
How can i limit # of character in Textbox or Textarea without using JAVA

thank
coolnyc is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 03-27-2005, 10:20 PM
drewrockshard's Avatar
Super Talker

Posts: 100
Name: Drew
Location: Garland (Dallas), Texas
Trades: 0
use javascript. ive never heard of using JAVA for the web (using web form handling)
__________________
Best Regards,
Drew Decker

Please login or register to view this content. Registration is FREE
drewrockshard is offline
Reply With Quote
View Public Profile
 
Old 03-27-2005, 11:26 PM
angele803's Avatar
Perfectly Imperfect

Posts: 1,772
Name: Stephanie
Location: Oklahoma
Trades: 2
Use the "size" attribute in your form tag. The number you set it to will be the number of characters that will be allowed in the box or field. If you are doing a text area, use rows and columns. This site shows how to do it. http://www.htmlgoodies.com/tutorials...le.php/3479121
angele803 is offline
Reply With Quote
View Public Profile
 
Old 03-28-2005, 12:06 AM
drewrockshard's Avatar
Super Talker

Posts: 100
Name: Drew
Location: Garland (Dallas), Texas
Trades: 0
wrong angele803, that isnt what he wants i dont think...

i beleive what he wants is to limit the number of characters. so bleieve you can do it with the "maxlength" attribute.
__________________
Best Regards,
Drew Decker

Please login or register to view this content. Registration is FREE
drewrockshard is offline
Reply With Quote
View Public Profile
 
Old 03-29-2005, 01:54 AM
Average Talker

Posts: 29
Trades: 0
There is attribute to set length of textbox.

<input type="text" name="T1" size="4" maxlength="5">

i hope this will work.

regards,
rakesh.
http://www.logixsoln.com
chetanrakesh is offline
Reply With Quote
View Public Profile Visit chetanrakesh's homepage!
 
Old 03-29-2005, 05:12 PM
drewrockshard's Avatar
Super Talker

Posts: 100
Name: Drew
Location: Garland (Dallas), Texas
Trades: 0
thats what i said
__________________
Best Regards,
Drew Decker

Please login or register to view this content. Registration is FREE
drewrockshard is offline
Reply With Quote
View Public Profile
 
Old 03-30-2005, 10:48 AM
simptech's Avatar
Skilled Talker

Posts: 81
Location: Cape Coral, Florida, United States
Trades: 0
scripting this would not be difficult either...

Code:
<input type="text" name="T1" size="4" onkeyup="if (this.value.length > 5) { alert('Character limit has been reached!'); this.value = this.value.substr(0,5); }">
This would probably be more helpful to the user. This way they would know why they cannot type any more characters
__________________

Please login or register to view this content. Registration is FREE

FREE PHP scripts for your website!
simptech is offline
Reply With Quote
View Public Profile
 
Old 03-30-2005, 10:49 AM
simptech's Avatar
Skilled Talker

Posts: 81
Location: Cape Coral, Florida, United States
Trades: 0
As for limiting a textarea, JavaScript or VBscript is your only option (so far as I know).
__________________

Please login or register to view this content. Registration is FREE

FREE PHP scripts for your website!
simptech is offline
Reply With Quote
View Public Profile
 
Old 03-30-2005, 10:56 AM
simptech's Avatar
Skilled Talker

Posts: 81
Location: Cape Coral, Florida, United States
Trades: 0
here's a quick-n-clean way to limit a textarea...

Code:
<script type="text/javascript">
<!--
function limit(field, chars) {
	if (field.value.length > chars) field.value = field.value.substr(0, chars);
	// next line is optional
	alert('You are only allowed to enter '+chars+' characters in the '+field.name+' field!');
}
//-->
</script>
Code:
<textarea name="S1" onkeydown="limit(this, 160)" onkeyup="limit(this, 160)" onkeypress="limit(this, 160)" onchange="limit(this, 160)"></textarea>
__________________

Please login or register to view this content. Registration is FREE

FREE PHP scripts for your website!
simptech is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Limit Textbox
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.31027 seconds with 12 queries