This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Five Lines of Code and have Christian Clausen on-line!
See this thread for details.
Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Why Is the 1st Condition Being Skipped?

 
Greenhorn
Posts: 7
Chrome Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


Annotation-2020-01-12-095040.jpg
[Thumbnail for Annotation-2020-01-12-095040.jpg]
First condition being skipped when correct credentials are entered
Annotation-2020-01-12-095117.jpg
[Thumbnail for Annotation-2020-01-12-095117.jpg]
Same thing happens when incorrect credentials are entered
 
Marshal
Posts: 25669
69
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You have a misspelling in line 2.
 
Marshal
Posts: 67414
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Always have the JavaScript debugger console open when developing JavaScript. You would have seen the syntax error.
 
Bear Bibeault
Marshal
Posts: 67414
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Also, learn how to use breakpoints. Stopping the execution and looking at the value of variables is far superior to just guessing by inspection.

Otherwise, you're fighting blind.

 
Marshal
Posts: 3144
465
Android Eclipse IDE TypeScript Redhat MicroProfile Quarkus Java Linux
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Also, since the values of the user and pass are only set when the script is initially loaded, and not when the validate function is called, the values will always be empty, regardless of what has been entered in to the form elements.
 
Bear Bibeault
Marshal
Posts: 67414
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Ron McLeod wrote:Also, since the values of the user and pass are only set when the script is initially loaded, and not when the validate function is called, the values will always empty, regardless of what has been entered in to the form elements.



Exactly. Something else easily uncovered in the debugger.
 
Ron McLeod
Marshal
Posts: 3144
465
Android Eclipse IDE TypeScript Redhat MicroProfile Quarkus Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And unrelated to your problem, I'm not sure what a heading element is, but I would assume that it should be inside the body element.:
Please correct me if I am wrong
 
Don't get me started about those stupid light bulbs.
    Bookmark Topic Watch Topic
  • New Topic