Win a copy of TDD for a Shopping Website LiveProject this week in the Testing 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

Having issues with validation code

 
Ranch Hand
Posts: 1087
Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Below is the validation code, but it is not working.I am not sure where I am going wrong in this?



 
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Replace "User-ID" name of textfield to "UserID".
- in the name creates problem parsing javascript.
 
Saloon Keeper
Posts: 25459
180
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Vishal Hegde
Ranch Hand
Posts: 1087
Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
Posts: 1087
Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am also facing issue in one other code



Not sure where i am going wrong
 
Ranch Hand
Posts: 343
Mac OS X Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Sheriff
Posts: 67634
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.
 
Grow your own food... or this tiny ad:
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
    Bookmark Topic Watch Topic
  • New Topic