javascript validation oopsie - Webmaster Forums - Webmaster forum for HTML, PHP, ASP, CSS and more
Webmaster Forums - Webmaster forum for HTML, PHP, ASP, CSS and more
Go Back   Webmaster Forums - Webmaster forum for HTML, PHP, ASP, CSS and more > Webmaster Tech > Programming > PHP Development

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 11-30-2008, 12:31 AM   #1 (permalink)
Junior Member
 
Join Date: Mar 2008
Location: Sullivan's Gulch
Posts: 4
Send a message via MSN to baruch menachem Send a message via Skype™ to baruch menachem
Default javascript validation oopsie

I have a little validation code that checks that fields are filled in. It sort of works, but the most important part fails.

the code:
function checkform(my_form)
{

var problem=false;
if(my_form.colno.value=="")
{
alert("There is no collection number!");
my_form.colno.value="please enter";
my_from.colno.focus();
problem=true;
}//collection
if(my_form.Pay.value=="pay")
{
alert("this is a paid collection");
}
if(my_form.amt.value=="")
{
alert("There is no amount");
my_form.amt.value="please enter";
my_form.amt.focus();
problem=true;
}

if (problem)
{return false;}//yes problem

else
{return true;} //no problem


}//function

If there is a problem, the processing of the form is supposed to halt and go back to the form. The problem I am having is I get the alerts, but then the page goes and processes to the next page.

why doesn't the function return false like it is supposed to?
Is the answer painfully obvious that I am missing?
NB, I am doing similar checks on the server side too, I just wanted to do a little client side checking first.
baruch menachem is offline   Reply With Quote
Sponsored Links
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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



» Sponsors

» Links

» Affiliates
Web Hosting
Online Backup Reviews
Marketing Find
Merchant Select
SiteMap Builder
Host Compare

» Links

» Sports Network
Paintball Forum
Football Forum
Hockey Forum
Golf Forum
Boxing Forum
Lacrosse Forum
Baseball Forum
SnowBoarding Forum
Soccer Forum
MMA Forum


All times are GMT -4. The time now is 07:31 PM.


Powered by vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.2
Webmaster Forums
Web Hosting | Chicago Web Hosting | Web Hosting