Webmaster Forum

Go Back   Webmaster Forum > Web Development > Coding Forum

Coding Forum Problems with your code? Discuss coding issues, including JavaScript, PHP & MySQL, HTML & CSS, Flash & ActionScript, and more.


Reply
 
LinkBack Thread Tools Display Modes
Old 12-30-2003, 02:45 PM   #1 (permalink)
Senior Member
 
Join Date: 10-29-03
Posts: 215
iTrader: 0 / 0%
Latest Blog:
None

Limit is a jewel in the roughLimit is a jewel in the roughLimit is a jewel in the roughLimit is a jewel in the roughLimit is a jewel in the roughLimit is a jewel in the rough
Validation For Forms

Is there any way i can make required fields and validate email addresses so that test@test.com, etc.... cannot be put in.
Limit is offline  
Add Post to del.icio.us
Reply With Quote
Old 01-07-2004, 10:47 AM   #2 (permalink)
Junior Member
 
Join Date: 01-07-04
Location: Scotland
Posts: 3
iTrader: 0 / 0%
Latest Blog:
None

spikemeister is liked by many
the only problem with this is that test@test.com could be a valid email address. you could try this link
http://www.hotscripts.com/Detailed/16824.html
to find a script that will validate the entries

you can use the script below to make sure fields are filled in

<script language="javascript">
<!--
function checkfields()
{
if (document.simpleform.name.value=="")
{
alert("Please enter your name.");
}
else
{
location.href="formthankyou.html";
}
}
-->
</head>
<body>

<form name="simpleform">
Name: <input type="text" size="20" name="name">
<input type="Button" value="Submit" name="Submit" onclick="checkfields()">
</form>
</body>

just add whichever fields you may require
spikemeister is offline  
Add Post to del.icio.us
Reply With Quote
Old 01-07-2004, 07:40 PM   #3 (permalink)
Senior Member
 
digitalpoint's Avatar
 
Join Date: 10-20-03
Location: San Diego, California
Posts: 243
iTrader: 0 / 0%
digitalpoint is just really nicedigitalpoint is just really nicedigitalpoint is just really nicedigitalpoint is just really nicedigitalpoint is just really nicedigitalpoint is just really nicedigitalpoint is just really nicedigitalpoint is just really nicedigitalpoint is just really nicedigitalpoint is just really nicedigitalpoint is just really nice
Also, if you want to do it within your script you are submitting to (works better because some people may not have JavaScript enabled), you could do something like this:

[code:1:87aa1c7f2a]if (strlen ($email_address) < 7 || substr_count ($email_address, ".") == 0 || substr_count ($email_address, "@") != 1) $error = "Bad email";[/code:1:87aa1c7f2a]

Quick hack off the top of my head, but that would work in PHP (and other languages with minor syntax changes).

Basically makes sure the email address is 7 or more characters long, has at least 1 "." in it and one "@" in it.

You could of course go crazy with the logic, but that's a simple way to do it.

- Shawn
digitalpoint is offline  
Add Post to del.icio.us
Reply With Quote
Old 01-08-2004, 03:52 AM   #4 (permalink)
Junior Member
 
Join Date: 01-07-04
Location: Scotland
Posts: 3
iTrader: 0 / 0%
Latest Blog:
None

spikemeister is liked by many
Your host will however then need need to allow you to use php scripts.
spikemeister is offline  
Add Post to del.icio.us
Reply With Quote
Old 01-08-2004, 08:39 AM   #5 (permalink)
Moderator
 
LazyJim's Avatar
 
Join Date: 10-13-03
Location: UK
Posts: 2,468
iTrader: 0 / 0%
Latest Blog:
None

LazyJim is a splendid one to beholdLazyJim is a splendid one to beholdLazyJim is a splendid one to beholdLazyJim is a splendid one to beholdLazyJim is a splendid one to beholdLazyJim is a splendid one to beholdLazyJim is a splendid one to beholdLazyJim is a splendid one to beholdLazyJim is a splendid one to beholdLazyJim is a splendid one to beholdLazyJim is a splendid one to behold
Send a message via MSN to LazyJim
emails can be validated with Regular Expressions and the domain can be varified for accepting email using PHP

Javascript can check for fields filled in and validate the email string with Regular Expressions.

the server-side validation is the most important as like said above, some ppl don't have JavaScript on.

If you don't have PHP I could host the PHP for you in exchange for links or something.
__________________

-LJ-

My advice is to look at each case individually, with an informed mind and an appropriately balanced and objective viewpoint.

Web Design and Development, Ipswich, UK.
My deviantArt
LazyJim is offline  
Add Post to del.icio.us
Reply With Quote
Go Back   Webmaster Forum > Web Development > Coding Forum

Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Web-Standards Validation bedlam17 Coding Forum 4 05-28-2007 01:03 AM
Javascript or PHP validation? ATLien Coding Forum 23 04-20-2007 03:53 PM
Help me understand Validation. sachi Web Design Lobby 4 02-11-2007 02:32 PM
My first w3c validation awall19s brother SEO Forum 1 08-11-2006 10:56 AM
Image Validation Sketch Coding Forum 4 02-14-2006 06:05 AM


Sponsor Links
Get exposure! Contextual Links V7N SEO Blog V7N Directory


All times are GMT -7. The time now is 07:06 PM.
© Copyright 2008 V7 Inc
Powered by vBulletin
Copyright © 2000-2009 Jelsoft Enterprises Limited.


Search Engine Optimization by vBSEO 3.3.0 ©2009, Crawlability, Inc.