473,563 Members | 2,767 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Validation in form, detecting a specific character

Hello,

I'm a total newbie on Javascript, and with a lot of help and some copy
and paste managed to get things running.

On my site: http://home.wanadoo.nl/homepage I use a form from
Bravenet. This works fine.

Unfortunately some persons fill in their e-mail address instead of the
URL of their page. Checking is done on empty fields but how to avoid
that a certain character "@" is used???

if (document.Brave net.URL.value == "") {correct = false;
alert("message to display when empty")}

The above works fine for an empty field. I've been checking on
Javascript operators but can't get it working on detecting for the @
character.

Anybody a good idea??

Thanks in advance and regards from Holland.

Frank
Jul 20 '05 #1
2 2224
Frank wrote on 30 nov 2003 in comp.lang.javas cript:
if (document.Brave net.URL.value == "") {correct = false;
alert("message to display when empty")}

The above works fine for an empty field. I've been checking on
Javascript operators but can't get it working on detecting for the @
character.


Use a regular expression:

if (/@/.test(document. Bravenet.URL.va lue)) {
correct = false;
alert("@ detected\nmisse boel dus")
}
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jul 20 '05 #2
"Evertjan." <ex************ **@interxnl.net > wrote in message news:<Xn******* *************@1 94.109.133.29>. ..
Frank wrote on 30 nov 2003 in comp.lang.javas cript:
if (document.Brave net.URL.value == "") {correct = false;
alert("message to display when empty")}

The above works fine for an empty field. I've been checking on
Javascript operators but can't get it working on detecting for the @
character.


Use a regular expression:

if (/@/.test(document. Bravenet.URL.va lue)) {
correct = false;
alert("@ detected\nmisse boel dus")
}


Hallo Evertjan.

Tnx a lot, works fine!

Hartelijke groeten,

Frank
Jul 20 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

21
6208
by: AnnMarie | last post by:
<script language="JavaScript" type="text/javascript"> <!-- function validate(theForm) { var validity = true; // assume valid if(frmComments.name.value=='' && validity == true) { alert('Your full name is required. Please enter your full name!'); validity = false; frmComments.name.focus();
72
5160
by: Stephen Poley | last post by:
I have quite often (as have probably many of you) come across HTML forms with irritating bits of Javascript attached. The last straw on this particular camel's back was a large form I was asked to complete in connection with attendance at a seminar. After spending more than 15 minutes on it, I clicked on the submit button - and nothing...
4
1757
by: Ray | last post by:
I've got a couple of webpages that I am trying to validate but I get this error message when trying to validate them with the www.w3.org HTML validator: I was not able to extract a character encoding labeling from any of the valid sources for such information. Without encoding information it is impossible to validate the document. The...
5
2585
by: EviL KerneL | last post by:
Hi - I am trying to figure out a way to enforce the validation included for this form based on whether the user chooses "email" or "phone" as the contact choice. Right now it is set to enforce validation on both. Is there a way to link the drop-down choice to the correspondent validation section while disabling validation for the other...
5
2796
by: Richard Brown | last post by:
Ok, I've been looking through the .NET SDK docs and stuff. I'm wondering if you can provide a control extender that does generic validation or functionality just by dropping it on the form. For instance, using the IExtenderProvider interface, you can specify properties, but there is nothing documented about linking into a control's events....
9
4160
by: julie.siebel | last post by:
Hello all! As embarrassing as it is to admit this, I've been designing db driven websites using javascript and vbscript for about 6-7 years now, and I am *horrible* at form validation. To be honest I usually hire someone to do it for me, grab predone scripts and kind of hack out the parts that I need, or just do very minimal validation...
2
4871
by: this one | last post by:
I have the following code <html> <head> <title>Untitled Document</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <script language="JavaScript" src="..\include\gen_validatorv2.js" type="text/javascript"></script> </head>
1
2255
by: =?Utf-8?B?UmF5IE1pdGNoZWxs?= | last post by:
Hello, I have a KeyDown event in which I would like to determine if the current key is a standard character (i.e., from the ASCII character set). In C I would use something like the isascii finction for this, but I realize the key values produced by the Keys enumeration are not simply the ASCII value of the keys. I've found references to...
2
2203
by: Sudhakar | last post by:
A) validating username in php as part of a registration form a user fills there desired username and this is stored in a mysql. there are certain conditions for the username. a) the username should only begin either letters or numbers, and Underscore character example = user123, 123user, u_ser123, user_123 = completely case insensitive
0
7665
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7583
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8106
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7642
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7950
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5484
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5213
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
1
2082
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1200
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.