473,406 Members | 2,371 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Text Box 'character' Validation

8
Hi All,
i'm new to posting in this forum , yet i have been lurking for a while.

I was wondering if anyone has advice on how i can add a validation of a textbox .
I'd like to set a min of 2 characters & a max of 50.
I've searched around at previous posts & different sites , but i havent had a clar example
Thanks in advance
Napalm
Oct 17 '06 #1
6 4318
Napalm
8
Hi,
i've sorted this out . It was just a simple expression.

however,
if anyone could help me with an expression to detect if a user duplicates an input code ?.

Thanks
Oct 17 '06 #2
bharathreddy
111 100+
Dear Napalm,

If u want the validations to be done on the client side then:

Note : textbox name = txtbox1
submitbutton = btnSubmit


Javascript function
--------------------------:
function validation1()
{
var txtbox1= document.getElementById('txtbox1');

if(txtbox1.length>2 && txtbox1.length<50)
{
return true;
}
else
{
alert('Enter min 2 charts and max 50');
return false;
}

}


In html:

<input type=button name=btnSubmit onclick='return validation1();'>

summary: what happens is when a user enters less than 2 chars or more than 50 chars then error message will be displayed ("Enter min 2 charts and max 50'"). And the form is not posted in this case.
Oct 17 '06 #3
Napalm
8
Thank bharathreddy
i appreciate the info.
napalm
Oct 17 '06 #4
nmsreddi
366 256MB
hello naplam

can u post the solution that you found


regards
nmsreddi
Oct 19 '06 #5
Napalm
8
This was the validation code that i was helped with.
Thanks



If Len(txtInputDesc.Text) > 1 And Len(txtInputDesc.Text) < 51 Then
'All OK
Else
MsgBox("Please Enter A Description Between 2 and 50 characters")
End If



napalm
Oct 21 '06 #6
nmsreddi
366 256MB
Hello napalm

this is the code in code behind have you not used any script becoz if you go for web application using c#.net you can't find msgbox ,i am looking for script for validating ,for my webapplication using c#.net


any how many thanks for your reply

thanks &regards

nmsreddi
Oct 23 '06 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

9
by: lawrence | last post by:
Someone on www.php.net suggested using a seems_utf8() method to test text for UTF-8 character encoding but didn't specify how to write such a method. Can anyone suggest a test that might work?...
76
by: Zenobia | last post by:
How do I display character 151 (long hyphen) in XHTML (utf-8) ? Is there another character that will substitute? The W3C validation parser, http://validator.w3.org, tells me that this character...
9
by: refer_to_website | last post by:
My VB.NET web application has a textbox where the user is allowed to enter up to 50 characters. I have a label on the form next to the textbox that tells the user how many remaining characters he...
3
by: addi | last post by:
I'm looking to perform input validation on an HTML input text element; specifically, I'm looking to prevent anything other than numerical characters from being entered. I've got it working just...
1
by: Kermit Piper | last post by:
Hello, OK, almost there. Here's what I have so far, which handles characters as they're typed in. Could someone please show me how I would loop through all the values that are entered if a block...
1
by: prabhunew2005 | last post by:
I am doing text box validation in form. I did the following validations. 1)Special characters like $,#,etc should not be allowed to enter by user. 2)Only alphanumerical characters should be...
1
by: ramanagh | last post by:
Please help me the validation for the following task.. Task : Using the JavaScript, I want to restrict the user to enter 1st letter of the text should be character(A-Z or a-z), Entire text should...
3
by: den | last post by:
inner a text element if I want to allow the insertion of only: alphabet's letters a,b,c,.... and A,B,C,... number and this - and this _ and not want space blank and others characters what is...
14
by: greentiger1 | last post by:
I'm moderately experienced in CSS. I am currently working on a new version of my site, built from the ground up, but the dynamic portion, loaded with a PHP include into the 'chest' DIV is being...
9
by: Steve | last post by:
Hi; I've being going through some legacy code on an old JSP site I have been patching. I noticed that when I save the JSP down to my PC as an HTML file I get this javascript error in IE 6 ( ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.