GeeCON Prague 2014*
The moose likes HTML, CSS and JavaScript and the fly likes Having issues with validation code Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Having issues with validation code" Watch "Having issues with validation code" New topic
Author

Having issues with validation code

Vishal Hegde
Ranch Hand

Joined: Aug 01, 2009
Posts: 1055

Below is the validation code, but it is not working.I am not sure where I am going wrong in this?




http://www.lifesbizzare.blogspot.com || OCJP:81%
Nikhil Padharia
Ranch Hand

Joined: Apr 19, 2012
Posts: 37
Replace "User-ID" name of textfield to "UserID".
- in the name creates problem parsing javascript.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16101
    
  21

Well, the first place you went wrong was when you decided to write your own login instead of using the J2EE standard security system. Do-it-Yourself security systems are horribly insecure. In all the years I've worked with J2EE, I've never run across one that couldn't be cracked in fairly short order.

However, your more immediate problem is that you forgot to return "true" from your validation Javascript.


Customer surveys are for companies who didn't pay proper attention to begin with.
Vishal Hegde
Ranch Hand

Joined: Aug 01, 2009
Posts: 1055

Tim Holloway wrote:Well, the first place you went wrong was when you decided to write your own login instead of using the J2EE standard security system. Do-it-Yourself security systems are horribly insecure. In all the years I've worked with J2EE, I've never run across one that couldn't be cracked in fairly short order.

However, your more immediate problem is that you forgot to return "true" from your validation Javascript.



Dear Tim,

Yes I know its insecure I just want to do something from Scratch... from start... and be like you people a JavaGuru :)
Vishal Hegde
Ranch Hand

Joined: Aug 01, 2009
Posts: 1055

I am also facing issue in one other code



Not sure where i am going wrong
Palak Mathur
Ranch Hand

Joined: Jan 29, 2007
Posts: 313

Hi Vishal,

When you are using Javascript, and want to traverse to the element using the format , then it is better not to include hyphen ('-"). In its place, it is better always to use an underscore("_") or better still to join the words like("userID").

Moreover, I would recommend you to add an attribute "id" to the element. like . In this case you can use the following:
and this will work absolutely fine.


Palak Mathur | My Blog | TechJaunt | What is JavaRanch? | List of All FAQs
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61315
    
  66

Palak Mathur wrote:
When you are using Javascript, and want to traverse to the element using the format ,

Nope. That's an antiquated format that has lots of problems. Use document.getElementById() or one of the other locator methods. Or use a library such as jQuery.

Moreover, I would recommend you to add an attribute "id" to the element. like . In this case you can use the following:
and this will work absolutely fine.

This is a better suggestion.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
GeeCON Prague 2014
 
subject: Having issues with validation code