Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

JavaScript Forum


You are currently viewing our JavaScript Forum as a guest. Please register to participate.
Login



Reply
Form Validation Help Needed Please
Old 12-05-2006, 04:05 AM Form Validation Help Needed Please
Junior Talker

Posts: 4
Trades: 0
I am knew here so hi to everyone, I have been told by a friend that this site is particularly helpful so here goes.

I have a form that i want to ensure is filled out correctly before the user is able to proceed. I am also advised that Javascript is the easiest way to do this, however i have no idea how to implememnt it.

http://chimp.cc/start.htm

If the user fails to fill out the terms and conditions box with a "Yes"when the user clicks submit, i want a message to pop up to tell them to complete it.

and to return the user to that field for completion.

I honestly have no idea how to do this, can someone please help me.

I have attached the source code too.

Cheers

Andy
Attached Files
File Type: zip code.zip (5.1 KB, 1 views)
chimp is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 12-05-2006, 09:53 PM Re: Form Validation Help Needed Please
jason_bristol's Avatar
Ultra Talker

Latest Blog Post:
New site - ConnectFrench.com
Posts: 310
Name: Jason Eyermann
Location: england bristol
Trades: 0
Hi chimp welcome to the forum.

I use a javascript popup that occurs when someone does not fill in the name for my guest book.

I guess you need the same sort of thing. If you want to learn how to do it there is a good tut at http://www.tizag.com/javascriptT/javascriptform.php for form validation.


for my site i added this code in the body

HTML Code:
 <script type="text/javascript">

function formValidator(){
    var firstname = document.getElementById('moreInfo');
    if(emptyBox(firstname, "Please enter your name.")){
                            return false;
                        } else {
        return true;
    
}
}
      function emptyBox(elementJason, returnMessage) {
           if (elementJason.value.length == 0) {
                 alert(returnMessage);
                 elementJason.focus();
                 return true;
            } else {
              return false;
        }
        }
        </script>
and i used onsubmit="return formValidator()" in the form
and include the id="moreinfo" in the correct field.

ofcourse you will need to make a few ajustments inorder to use it on a checkbox.
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
jason_bristol is offline
Reply With Quote
View Public Profile Visit jason_bristol's homepage!
 
Old 12-13-2006, 11:22 AM Re: Form Validation Help Needed Please
dansgalaxy's Avatar
Defies a Status

Posts: 6,522
Name: Dan
Location: Swindon
Trades: 0
btw its called a alert not a pop-up a pop-up is a seperate page in a seperate window what you want is a little box with text aka a alert...

Dan
__________________
Discounted Web Hosting With XDnet!
>> Get 25% of hosting~ Promo: Webmaster-talk <<

Please login or register to view this content. Registration is FREE
dansgalaxy is offline
Reply With Quote
View Public Profile Visit dansgalaxy's homepage!
 
Reply     « Reply to Form Validation Help Needed Please
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.69222 seconds with 13 queries