Forum Moderators: open
Q1 I want to allow user enter jus characters in a text box, how do i do that and i want validation as soon as it looses focus (onBlur?)and if error, the cursor goes back where the error was!
Q2 Also on client side, how do i validate, like i have to query with the database, to check if user exsists?
Q3 I need to allow some user to access some webpages of my document and others shld not be allowed, how do i do these?
Hope not a big thing, help me out guyzz
Q1: check for 'characters only' by using a regular expression like
if (userInput.search(/[^a-zA-Z]/) > -1) {
// fail
}
onBlur can indeed be used to trigger a function that does the validation and on failure sets focus on the field with the non-validating input.
Q2 can't be done client-side. The only way to send form data to the server is by submitting the form.
Q3 is probably done best by providing some users a login and password. There are several server-side techniques for user authentication. An easy to implement technique is using .htpasswd and .htaccess
Hope this helps...