Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Page 6 of 9 FirstFirst ... 45678 ... LastLast
Results 76 to 90 of 124
  1. #76
    Regular Coder
    Join Date
    Apr 2013
    Posts
    112
    Thanks
    1
    Thanked 0 Times in 0 Posts
    The way i've done the code is the way we're following from our prescribed textbook old pedant :P

  2. #77
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,857
    Thanks
    78
    Thanked 4,416 Times in 4,381 Posts
    I don't think I believe that. Maybe you are using *SOME* of the stuff from the textbook, but clearly not all of it. The textbook couldn't possibly be as wrong as much of your code has been.
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  3. #78
    Regular Coder
    Join Date
    Apr 2013
    Posts
    112
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Well i'm changing the variable names around etc, but my syntax using the DOM is based on the textbook man, trust me lol.. Can you check my code on page 5 and tell me why the Date of birth function isn't working but everything else is ?

  4. #79
    Regular Coder
    Join Date
    Apr 2013
    Posts
    112
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Has something to do with this bit of code
    It works when i remove
    Code:
    if (document.getElementById('agreed').checked == false) 
     		{
    
      		alert ("You didn't agree to the terms");
    
      		return true;
    
    		 } 
     		else
      		{
    	
    
    		 }

  5. #80
    Senior Coder
    Join Date
    Dec 2010
    Posts
    2,398
    Thanks
    12
    Thanked 570 Times in 563 Posts
    So ... you are returning "true" ... which means "go on and submit the form" if the AGREED checkbox has NOT been set????? And you didn't find that out by yourself?

    Please ask your teacher to teach you the basic methods of debugging (which should be part of the very first lesson every teacher gives).

  6. #81
    Regular Coder
    Join Date
    Apr 2013
    Posts
    112
    Thanks
    1
    Thanked 0 Times in 0 Posts
    i deleted return true but still doesn't display an alert? Can u check my file in page 5 please and let me know what i did wrong ?

  7. #82
    Master Coder felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, Australia
    Posts
    6,642
    Thanks
    0
    Thanked 649 Times in 639 Posts
    Why don't you do what I suggested quite some time ago and build the code piece by piece testing as you go. That's what alert() if for - so you can see the result of an as yet incomplete script. You would never include an alert in a live script as it offers some of your visitors the opportunity to turn JavaScript off for your page.

    The easiest way to ensure any JavaScript works properly is to build one section of code, test it until you are sure that part works and then move on to the next piece.

    Presumably your teacher did cover how to debug JavaScript at some point in the course as that is the only use that alert() has - unless it is a really old course that expects all visitors to be using Netscape 4 or earlier.
    Stephen
    Learn Modern JavaScript - http://javascriptexample.net/
    Helping others to solve their computer problem at http://www.felgall.com/

    Don't forget to start your JavaScript code with "use strict"; which makes it easier to find errors in your code.

  8. #83
    Regular Coder
    Join Date
    Apr 2013
    Posts
    112
    Thanks
    1
    Thanked 0 Times in 0 Posts
    felgall i've been trying to debug my code on the previous page i attached, all bit of code is working except one validation, i'm confused wiTh the return true's return false, i think thats why one of the validations arent working ?

  9. #84
    Master Coder felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, Australia
    Posts
    6,642
    Thanks
    0
    Thanked 649 Times in 639 Posts
    Code:
    if (document.getElementById('agreed').checked == false) 
     		{
    
      		alert ("You didn't agree to the terms");
    
      		return false;
    }
    .
    Stephen
    Learn Modern JavaScript - http://javascriptexample.net/
    Helping others to solve their computer problem at http://www.felgall.com/

    Don't forget to start your JavaScript code with "use strict"; which makes it easier to find errors in your code.

  10. #85
    Regular Coder
    Join Date
    Apr 2013
    Posts
    112
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Elaborate fellgall? If i delete the return false it still doesn't work?

  11. #86
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,857
    Thanks
    78
    Thanked 4,416 Times in 4,381 Posts
    Then you have some error *AFTER* that code, of course!

    USE THE DEBUGGER!
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  12. #87
    Regular Coder
    Join Date
    Apr 2013
    Posts
    112
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Nevermind fixed it ha :P

  13. #88
    Regular Coder
    Join Date
    Apr 2013
    Posts
    112
    Thanks
    1
    Thanked 0 Times in 0 Posts
    javascript is a love hate relationship , i'm gonna study javascript from scratch once this semester is finished. Thing is whilst being at uni everything is powered through so u only have like 1 week to grasp everything then next week is completely something new, im not quite programming oriented at this point in time ha.. Any idea how i would do this ?

    "These are only activated to input values if section B (see section 4 where EOI_form.php is explained) is filled in.
    For both of these items appropriate input devices should be selected and it is mandatory to enter values for both."

    THis is the last part of a different form, basically the form i uploaded on page 5 has sections A-D, IF section B is selected how would i show an alert for my new form ?

  14. #89
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,857
    Thanks
    78
    Thanked 4,416 Times in 4,381 Posts
    "These are only activated...
    How in the name of Beelzebub are we supposed to guess what in the Inferno "These" are????

    And why in the name of Charon would you "show an alert"? What in all of the River Styx does that have to do with a *form*? And why would you use a "new form" in any case.

    I *THINK* all it means is that you are supposed to hide certain parts of the (ONE AND ONLY) <form> until/unless Section B is "filled in" (whatever that means). Once B is "filled in" you then display "These" and, because they are now showing, you are required to then validate them.

    But man is that guessing a lot from a FRAGMENT of the instructions.
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  15. #90
    Regular Coder
    Join Date
    Apr 2013
    Posts
    112
    Thanks
    1
    Thanked 0 Times in 0 Posts
    I forgot to add, it's for these Section " ps4i and ps4ii" i attached the form also so u can get a idea, because im bloody clueless...


 
Page 6 of 9 FirstFirst ... 45678 ... LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •