Phil Amey wrote:
I would like to prevent certain characters from being input to some form cells, e.g. ~ # ' and so on.
I'm currently using this format to check the input data of cells -
if (document.form1.EMAIL.value == ""){
alert("Please complete the E-Mail: field")
document.form1.EMAIL.focus()
validFlag = false
return validFlag
}
It would also be nice to learn how to check this particular cell for a valid email address, I assume that you search for the @.
Could someone show me how I could modify this to prevent characters of my choice.
Kindest Regards - Philip Amey
For removing special characters, use the javascript string methods
(indexOf, substr, split, join, etc) to do it the way you need.
For email addresses, I like to make sure there is an @ character, and in
the host side, there is a high-level domain *.* (*.com, *.net, *.edu,
etc, but stay with *.*, since it it is tough to know which high-level
domain names will exist in the future)
VERY IMPORTANT: Do not rely on javascript to make sure your server-side
form handler gets the correct input. If my browser does not support
javascript, or I simply send the HTTP request by hand, I can _easily_
circumvent the special characters, and break your form handler, if it
does not handle the special characters as well.
VERY IMPORTANT: Do not disregard the previous statement :)
Good luck,
Brian