/    Sign up×
Community /Pin to ProfileBookmark

[RESOLVED] textbox validation

Hi all,

I am going through a textbox validation.It will accept only characters like (a-z) and (A-Z)…..even no special chars.

Is there anyway.Please suggest me.

Thanks in advance for your kind co-operation.

Regards,
Raj

to post a comment
JavaScript

5 Comments(s)

Copy linkTweet thisAlerts:
@JMRKERApr 06.2008 — Do you have any code that you want analyzed?

If you are trying to enter special characters,

it will depend upon your character set defined, for example:

<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">

and unicodes you enter.

Do a search on 'unicodes' and 'character sets' for more information.
Copy linkTweet thisAlerts:
@raj_2006authorApr 06.2008 — Hi

Thanks for your post.Actually what I am trying is that the textbox will take only characters between (a-z) and (A-Z).

No numerics and special characters will be allowed.

So what I was planning to check the input based on ascii code of each character...but dont know how to write it in the javascript function.

Raj
Copy linkTweet thisAlerts:
@JMRKERApr 06.2008 — Do you need to check the input as typed

or do you want to check the final text when entry is completed?
Copy linkTweet thisAlerts:
@raj_2006authorApr 06.2008 — Hi

Thanks very much for your reply.

The input will be checked after the final form submission.

The onlick function is ready and other validations are also going ok.

Regards,

Raj
Copy linkTweet thisAlerts:
@raj_2006authorApr 07.2008 — Hi

Its solved...?

Here is the code:

[CODE]var ch= "!@#$%^&*()+=-[]\';,./{}|":<>?";
for (var i = 0; i < document.f.firstname.value.length; i++) {
if (ch.indexOf(document.f.firstname.value.charAt(i)) != -1) {
document.getElementById('err').innerHTML="This firstname contains illegal characters.";
document.getElementById('err').style.display="";
document.f.username.focus();
return false;
}
}[/CODE]


Thanks.

Raj
×

Success!

Help @raj_2006 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.20,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...